I am trying to automate a web-app (company specific) using Cypress which contains a page to take a picture using a web-cam. On clicking the 'Take a Photo' button, it shows an error message asking to provide access to the camera.
But, a browser pop-up is not displayed asking for permissions unlike the open-source website - https://webcamtests.com/
On looking at Cypress documentation, a default set of Chrome switches are being added to the browser before the launch which also includes
'--use-fake-device-for-media-stream'
'--use-fake-ui-for-media-stream'
I've removed them using the below code that is placed in the config file .
launchOptions.args = launchOptions.args.filter((arg) => {
return arg !== '--use-fake-device-for-media-stream' && arg !== '--use-fake-ui-for-media-stream'
})
Also, in the documentation it specifically says this reg the default switches- https://docs.cypress.io/guides/guides/launching-browsers#Launching-Browsers
"Disables prompts requesting permission to use devices like cameras or mics"
Am looking to see what is the corresponding switch for this and is there a way to enable the prompt to provide access?
Any help/suggestion is appreciated.
Cypress Version: 12.5.1
Chrome Version: 109
Platform - Mac
Note:
I've also tried using an open source library for enabling the camera permissions but it did not work.
https://github.com/kamranayub/cypress-browser-permissions
The prompt is displayed when automated using Web-Driver.
Please try this:
cy.request({
method: 'GET',
url: 'https://webcamtests.com/',
headers: {
'Content-Type': 'text/html',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36'
},
followRedirect: false,
body: {}
});
Above test simulate a real user request to the target website and trigger camera permissions pop-up.
Please keep in mind, it might not work for all websites as the pop-up is controlled by the website and user's browser.
Hope you Guys are doing good. I have 1 issue with my project functionality. I have 1 form in that form we have few fields and in last we have submit and download button. when we will click on submit and download button that time we will this error.
POST https://admin.default.com/manage_doc_download_popup/ajax/2091/674?token=... 500 (Service unavailable (with message)) Response Text: [{"command":"settings","settings":{"basePath":"\/","pathPrefix":"","ajaxPageState":{"theme":"capstore","theme_token":"gcu_X3w1KcbG7Lq6TmlXVMOupzbkdowwVgbpz_a-Xlo","js":{"sites\/all\/modules\/contrib\/ctools\/js\/ajax-responder.js":1}},"lightbox2":{"rtl":0,"file_path":"\/(\\w\\w\/)public:\/","default_image":"\/sites\/all\/modules\/contrib\/lightbox2\/images\/brokenimage.jpg","border_size":10,"font_color":"000","box_color":"fff","top_position":"","overlay_opacity":"0.8","overlay_color":"000","disable_close_click":1,"resize_sequence":0,"resize_speed":400,"fade_in_speed":400,"slide_down_speed":600,"use_alt_layout":1,"disable_resize":0,"disable_zoom":0,"force_show_nav":1,"show_caption":0,"loop_items":0,"node_link_text":"View Image Details","node_link_target":0,"image_count":"Image !current of !total","video_count":"Video !current of !total","page_count":"Page !current of !total","lite_press_x_close":"press \u003Ca href=\u0022#\u0022 onclick=\u0022hideLightbox(); return FALSE;\u0022\u003E\u003Ckbd\u003Ex\u003C\/kbd\u003E\u003C\/a\u003E to close","download_link_text":"Download Original","enable_login":false,"enable_contact":false,"keys_close":"c x 27","keys_previous":"p 37","keys_next":"n 39","keys_zoom":"z","keys_play_pause":"32","display_image_size":"","image_node_sizes":"()","trigger_lightbox_classes":"","trigger_lightbox_group_classes":"","trigger_slideshow_classes":"","trigger_lightframe_classes":"","trigger_lightframe_group_classes":"","custom_class_handler":0,"custom_trigger_classes":"","disable_for_gallery_lists":true,"disable_for_acidfree_gallery_lists":true,"enable_acidfree_videos":true,"slideshow_interval":5000,"slideshow_automatic_start":true,"slideshow_automatic_exit":true,"show_play_pause":true,"pause_on_next_click":false,"pause_on_previous_click":true,"loop_slides":false,"iframe_width":900,"iframe_height":520,"iframe_border":0,"enable_video":1,"useragent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/86.0.4240.193 Safari\/537.36","flvPlayer":"\/sites\/default\/files\/DCXCOE_DX_sv.mp4","flvFlashvars":""},"overlay":{"paths":{"admin":"file\/*\/downloads\nfile\/add\nfile\/add\/*\nfile\/*\/edit\nfile\/*\/usage\nfile\/*\/delete\nnode\/*\/edit\nnode\/*\/delete\nnode\/*\/revisions\nnode\/*\/revisions\/*\/revert\nnode\/*\/revisions\/*\/delete\nnode\/add\nnode\/add\/*\noverlay\/dismiss-message\nuser\/*\/shortcuts\nadmin\nadmin\/*\nbatch\ntaxonomy\/term\/*\/edit\nuser\/*\/cancel\nuser\/*\/edit\nuser\/*\/edit\/*\nnode\/*\/moderation\nnode\/*\/moderation\/*\/unpublish\nnode\/*\/moderation\/*\/change-state\/*\nnode\/*\/moderation\/view\nnode\/*\/moderation\/diff\nnode\/*\/moderation\/diff\/list\nnode\/*\/moderation\/diff\/view\nnode\/*\/moderation\/diff\/view\/*\/*","non_admin":"admin\/structure\/block\/demo\/*\nadmin\/reports\/status\/php"},"pathPrefixes":[],"ajaxCallback":"overlay-ajax"},"bootstrap":{"anchorsFix":"0","anchorsSmoothScrolling":"0","formHasError":1,"popoverEnabled":1,"popoverOptions":{"animation":1,"html":0,"placement":"right","selector":"","trigger":"click","triggerAutoclose":1,"title":"","content":"","delay":0,"container":"body"},"tooltipEnabled":1,"tooltipOptions":{"animation":1,"html":0,"placement":"auto left","selector":"","trigger":"hover focus","delay":0,"container":"body"}}},"merge":true},{"command":"insert","method":"prepend","selector":"head","data":"\u003Cscript src=\u0022https:\/\/admin.default.com\/sites\/all\/modules\/contrib\/ctools\/js\/ajax-responder.js?qjdm9a\u0022\u003E\u003C\/script\u003E\n","settings":null},{"command":"invoke","selector":".comment-form","method":"show","arguments":[]},{"command":"invoke","selector":".comment-section .fivestar-widget","method":"removeClass","arguments":["pointer"]},{"command":"css","selector":".comment-section .fivestar-widget div.on:last a","argument":{"width":"100%"}},{"command":"redirect","url":"https:\/\/admin.default.com\/file\/2091\/download?token=OEJk7avE","delay":0,"new_window":false},{"command":"modal_dismiss"}]
and will get error in this line in JS file
xhr.send( ( s.hasContent && s.data ) || null );
So guys if you have any idea about this please help me.And I'm new in this project so I don't know, how to start.. Please help guys. I have attached few images related to issue that will help to understand what the issue is.[Error 1] [Error 2]
Please help guys..!!!
I'm trying to assert that there is no mixed content in a website. I have set the log level equal to 1 in the chrome switches , but i m still unable to retrieve warning messages from the browser, here is the code im using.
browser = Watir::Browser.new :chrome,
switches: %w[--disable-gpu --no-sandbox
--disable-prompt-on-repost
--windows-size=3200x1800
--log-level=1]
console_log = browser.driver.manage.logs.get (:browser)
What am i doing wrong? or there is other way to set this log level to capture errors and warnings?
Work done ,, just changing the way i was passing the settings to the browsr is working
options = Selenium::WebDriver::Chrome::Options.new
options.add_argument('--disable-infobars')
options.add_argument('--disable-gpu')
options.add_argument('--no-sandbox')
options.add_argument('--disable-prompt-on-repost')
options.add_argument('--user-agent="Mozilla/5.0 (Linux; Android 6.0.1; SAMSUNG SM-G925F Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/4.0 Chrome/44.0.2403.133 Mobile Safari/537.36"')
I am trying to fetch an image from amazon with the following code. It fails to download the image, but if I do it with Internet Explorer, it works. Is there another way to simulate IE to make sure it gets the data?
Dim wc As New WebClient()
wc.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2")
Dim bytes As Byte() = wc.DownloadData("http://ecx.images-amazon.com/images/I/41NGYbQ1G0L._SS160_.jpg")
Dim ms As New MemoryStream(bytes)
You may use the DownloadFile method.
WebClient.DownloadFile Method (MSDN).
Recently, there are some visits to my site with UserAgent "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; LSIE 1.1.8.4)". What does the "LSIE" stand for?
LSIE is an additional information added to the UserAgent string
Usually a part of the UserAgent is used to add additional info about the used browser/machine/factory; LSIE seems to be an additional info added from BenQ-Siemens systems.
LSIE stands for "large scale internet extraction," which was program by the government to scrape the internet.
After Snowden's revelations the project's name was changed. I think the new name was "Everest."