selenium chromedriver python - default downloads folder [duplicate] - selenium

We recently upgraded our Windows 10 test environment with ChromeDriver v87.0.4280.20 and Chrome v87.0.4280.66 (Official Build) (64-bit) and after the up-gradation even the minimal program is producing this ERROR log:
[9848:10684:1201/013233.169:ERROR:device_event_log_impl.cc(211)] [01:32:33.170] USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
Minimum Code Block:
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument("start-maximized")
driver = webdriver.Chrome(options=options, executable_path=r'C:\WebDrivers\chromedriver.exe')
driver.get('https://www.google.com/')
Console Output:
DevTools listening on ws://127.0.0.1:64170/devtools/browser/2fb4bb93-79ab-4131-9e4a-3b65c08dbffb
[9848:10684:1201/013233.169:ERROR:device_event_log_impl.cc(211)] [01:32:33.170] USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
[9848:10684:1201/013233.172:ERROR:device_event_log_impl.cc(211)] [01:32:33.173] USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
Anyone facing the same? Was there any change in ChromeDriver/Chrome v87 with respect to ChromeDriver/Chrome v86?
Any clues will be helpful.

However these log messages can be supressed from appearing on the console through an easy hack i.e. by adding an argument through add_experimental_option() as follows:
options.add_experimental_option('excludeSwitches', ['enable-logging'])
Code Block:
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument("start-maximized")
# to supress the error messages/logs
options.add_experimental_option('excludeSwitches', ['enable-logging'])
driver = webdriver.Chrome(options=options, executable_path=r'C:\WebDrivers\chromedriver.exe')
driver.get('https://www.google.com/')

My apologies for the log spam. If you aren't having issues connecting to a device with WebUSB you can ignore these warnings. They are triggered by Chrome attempting to read properties of USB devices that are currently suspended.

After going through quite a few discussions, documentations and Chromium issues here are the details related to the surfacing of the log message:
[9848:10684:1201/013233.169:ERROR:device_event_log_impl.cc(211)] [01:32:33.170] USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
Details
It all started with the reporting of chromium issue Remove WebUSB's dependency on libusb on Windows as:
For Linux (probably Mac as well), both WebUSB notification and communication works correctly (after allowing user access to the device in udev rules).
For Windows, it seems that libusb only works with a non-standard WinUsb driver (https://github.com/libusb/libusb/issues/255).
When the hardware is inserted and the VID/PID is unknown to the system, windows 10 correctly loads it's CDC driver for the CDC part and the WinUSB driver (version 10) for the WebUSB part (no red flags). However, it seems that chrome never finds the device until I manually force an older WinUSB driver (version 6 - probably modified also) on the interface.
The solution was implemented in a step-wise manner as follows:
Start supporting some transfers in the new Windows USB backend
Fix bulk/interrupt transfers in the new Windows USB backend
[usb] Read BOS descriptors from the hub driver on Windows
[usb] Collect all composite devices paths during enumeration on Windows
[usb] Remove out parameters in UsbServiceWin helper functions
[usb] Support composite devices in the new Windows backend
[usb] Detect USB functions as Windows enumerates them
[usb] Support composite devices with multiple functions
[usb] Hold interface requests until Windows enumerates functions
[usb] Add direction parameter to ClearHalt
[usb] Count references to a WINUSB_INTERFACE_HANDLE
[usb] Implement blocking operations in the Windows backend
These changes ensured that the new backend was ready to be tested and was available through Chrome Canary and chrome-dev-channel which you can access manually through:
chrome://flags#enable-new-usb-backend
More change requests were submitted as follows:
[usb] Mark calls to SetupDiGetDeviceProperty as potentially blocking: According to hang reports this function performs an RPC call which may take some time to complete. Mark calls with a base::ScopedBlockingCall so that the thread pool knows this task may be busy for a while.
variations: Enable NewUsbBackend in field trial testing config: This flag was experimental as beta-channel uses this change configuration as the default for testing.
As the experimental launch of the new backend appeared to be stable, finally these configuration was enabled by default so that the chanege rolls out to all users of Chrome 87 through usb: Enable new Windows USB backend by default. Revision / Commit
The idea was once this configuration becomes the default for a few milestones, Chromium Team will start removing the Windows-specific code from the old back-end and remove the flag.
Road Ahead
Chromium Team have already merged the revision/commit to Extend new-usb-backend flag expiration within Chrome v90 which will be available soon.
Update
As per #ReillyGrant's [Committer, WebDriver for Google Chrome] comment :
..." it would be good to reduce the log level for these messages so they don't appear on the console by default but we haven't landed code to do that yet"...
References
You can find a couple of relevant detailed discussions in:
Failed to read descriptor from node connection: A device attached to the system is not functioning error using ChromeDriver Selenium on Windows OS
Failed to read descriptor from node connection: A device attached to the system is not functioning error using ChromeDriver Chrome through Selenium

I encounered this problem yesterday,and I has fixed it by update all available windows update.
https://support.microsoft.com/en-us/windows/what-to-try-if-your-touchscreen-doesn-t-work-f159b366-b3ef-99ad-24a4-31a4c62ab46d

A partial solution that worked for me
I was getting this error too. It was stopping my program running.
I unplugged all my USB devices, ran the program, with no error.
Plugged the devices back in, ran the program. I am still getting the error, however, the program finished without the error stopping the program.

Note: For WebdriverIO on Windows 10, this suppresses the error messages for me:
"goog:chromeOptions": { "excludeSwitches": ["enable-logging"] }

Related

ERROR:configuration_policy_handler_list.cc(90)] Unknown policy: DnsPrefetchingEnabled with ChromeDriver and Chrome using Selenium

Recently every time I run any BDD test, I seem to be getting the following error in command line-
running on chrome driver: 73/74.0.3729.6 and chrome 73
[17996:17852:0502/103000.545:ERROR:configuration_policy_handler_list.cc(90)] Unknown policy: DnsPrefetchingEnabled
[17996:17852:0502/103000.741:ERROR:configuration_policy_handler_list.cc(90)] Unknown policy: DnsPrefetchingEnabled
After that the command line stays open and chrome opens for few seconds closes and opens a new command line it does this around 5+ times.
I have tried the following thread -
Failed to read HKLM\SOFTWARE\Policies\Google\Chrome\MachineLevelUserCloudPolicyEnrollmentToken: The system cannot find the file specified. (0x2)
but that just seemed to create more issues. I've tried and updated the chrome driver to 73 and 74 but that did not fix the issue.
This error message...
[17996:17852:0502/103000.741:ERROR:configuration_policy_handler_list.cc(90)] Unknown policy: DnsPrefetchingEnabled
...implies that the ChromeDriver was unable to communicate with the WebBrowser i.e. Chrome Browser.
Some information about your Test Environment and the Binary versions you are using would have helped us to debug the issue in a better way. However an easy solution seems to be using the switch --dns-prefetch-disable through an instance of ChromeOptions as follows:
Details:
--dns-prefetch-disable
Disables prefetching of DNS information.
This switch was listed in chrome/common/chrome_switches.cc
Removed on 2014-11-14
Sample Code:
'chromeOptions': {
'args': ['--DNS-prefetch-disable']
}
DNS Prefetching
DNS resolution time can lead to a significant amount of user perceived latency. The time that DNS resolution takes is highly variable. Latency delays range from around 1ms (locally cached results) to commonly reported times of several seconds.
DNS Prefetching is an attempt to resolve domain names before a user tries to follow a link. This is done using the computer's normal DNS resolution mechanism; no connection to Google is used. Once a domain name has been resolved, if the user does navigate to that domain, there will be no effective delay due to DNS resolution time. The most obvious example where DNS prefetching can help is when a user is looking at a page with many links to various domains, such as a search results page. When we encounter hyperlinks in pages, we extract the domain name from each one and resolving each domain to an IP address. All this work is done in parallel with the user's reading of the page, using minimal CPU and network resources. When a user clicks on any of these pre-resolved names, they will on average save about 200 milliseconds in their navigation (assuming the user hadn't already visited the domain recently). More importantly than the average savings, users won't tend to experience the "worst case" delays for DNS resolution, which are regularly over 1 second.
BuiltInDnsClientEnabled
BuiltInDnsClientEnabled: Uses the built-in DNS client.
Data type:
Boolean [Windows:REG_DWORD]
Windows registry location for Windows clients:
Software\Policies\Google\Chrome\BuiltInDnsClientEnabled
Mac/Linux preference name:
BuiltInDnsClientEnabled
Supported on:
Google Chrome (Linux, Mac, Windows) since version 25
Supported features:
Dynamic Policy Refresh: Yes, Per Profile: No
Description:
Controls whether the built-in DNS client is used in Google Chrome.
If this policy is set to true, the built-in DNS client will be used, if available.
If this policy is set to false, the built-in DNS client will never be used.
If this policy is left not set, the built-in DNS client will be enabled by default on MacOS, Android (when neither Private DNS nor VPN are enabled) and ChromeOS, and the users will be able to change whether the built-in DNS client is used by editing chrome://flags or specifying a command-line flag.
Example value:
0x00000001 (Windows), true (Linux), <true /> (Mac)
tl; dr
Both Chromium and Google Chrome support the same set of policies. Please note that this answer may include unreleased policies which are subject to change or removal without notice and for which no guarantees of any kind are provided, including no guarantees with respect to their security and privacy properties.
These policies are strictly intended to be used to configure instances of Google Chrome internal to your organization. Use of these policies outside of your organization (for example, in a publicly distributed program) is considered malware and will likely be labeled as malware by Google and anti-virus vendors.
These settings don't need to be configured manually! Easy-to-use templates for Windows, Mac and Linux are available for download from https://www.chromium.org/administrators/policy-templates.
Last updated on 2019-04-24 based on Chrome 76.0.3776.
Mine worked after I re-downloaded matching ChromeDriver. Apparently, the driver I'm using no longer support my browser after I updated it.
ChromeDriver has different versions, and it should match your current Chrome browser version.
ie.
my current browser is version 77
so I had to download ChromeDriver for version 77

Unable to perform activities on edge after opening the browser

System.setProperty("webdriver.edge.driver","F:\\VW_MU_Util\\MicrosoftWebDriver.exe");
WebDriver driver = new EdgeDriver();
This is opening the edge browser however I cant go ahead since i'm getting error as:
org.openqa.selenium.remote.SessionNotFoundException: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones. Enable Protected Mode must be set to the same value (enabled or disabled) for all zones. (WARNING: The server did not provide any stacktrace information)
I tried to change the IE security settings but its opening the IE browser which i dont want to.
Make sure you have initiate correct Edge Driver, as according to your OS version.
Ref link : https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
Steps :
Trace Build version:
Download correct version of Driver:
Once it finished, Verify it with demo project without any project capabilities. If it run successfully on sample project, It might cause browser capability with Selenium Browser.

Sinch webRTC DevicesNotFoundError on Chrome Mozilla et al

I am trying to setup up video calling in my webapp using Sinch. The application works well on my Chrome (50.0.2661.102 64 bit) but a friend using windows (same version chrome but 32 bit) gets a NavigatorUserMediaError with a reason : DevicesNotFoundError.
I tried using mozilla, vivaldi and IE but non of them works. The error is in the sinch.min.js file and I am using the latest version from their repository : https://cdn.sinch.com/latest/sinch.min.js
Can someone please help me fix these issues?
Also, are there any javascript libraries to help prevent cross-browser compatibility issues while using webRTC.
Thanks
Only WebRTC browsers work with sinch
The NavigatorUserMediaError error with err.name=DevicesNotFoundError is a Chrome specific error and it's quite common. It happens when:
you’re requesting a video track through constraints but the user does not have a webcam
you request an audio track but there is no attached recording device or it's disabled at the OS level (possible in Windows and some drivers do it automatically if there's no microphone inserted in the mic jack)
DevicesNotFoundError will be replaced by the spec compliant NotFoundError in Chrome 64.
Source: Common getUserMedia() Errors

Flash movie only renders in Chrome, not WebBrowser control?

I'm getting an output message (Vector smash protection is enabled) in the debugging output window (Visual Studio) when I navigate to this URL with a WebBrowser.
The URL redirects to an embedded video player from Dailymotion. It should look like this :
But it looks like this :
What this message means? Why do I have a black screen (the video isn't shown)? How to fix it?
Edit : You can see all the code in the last screenshot...
I noticed something similar myself.
I got the following when installing python webbrowser:
Vector smash protection is enabled.
java version "1.7.0_79"
OpenJDK Runtime Environment (IcedTea 2.5.6) (7u79-2.5.6-0ubuntu1.14.04.1)
OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)
I am convinced that it is to prevent a type of denial of service attack, just released in Java 1.7, with no fanfare.
see:
http://docs.oracle.com/javase/7/docs/api/java/util/Vector.html
and
http://www.oracle.com/technetwork/java/seccodeguide-139067.html
Edit 1:
As my issue was coming from the pdf viewer atril, I approached the writers of the program and they have informed me that the Vector smash protection is enabled message is being issued by Webkit. Atril added a new epub backend to their code and it uses Webkit.
A cursory search suggests that it is a defence against a stack smash or heap spraying attack, although don't hold me to it.
The reason that this message seems to be popping up across browsers, viewers and indeed operating systems, appears to be directly related to how many programs now use webkit under the hood, as it were.
Here are 2 lists of code making use of webkit:
http://trac.webkit.org/wiki/ApplicationsGtk
http://trac.webkit.org/wiki/Applications%20using%20WebKit
As usual, if in doubt, your own research may prove more effective than mine but I for one am much happier about the message, now that I know what it is.
Should I come across anything else germane, I'll edit this post.
The message "Vector smash protection is enabled." is emitted by Flash.ocx (you can find it in the DLL). It's likely related to this security mitigation: http://googleprojectzero.blogspot.com/2015/07/significant-flash-exploit-mitigations_16.html
You can deal with this problem using the chrome options and creating a desired capabilities but first of all you need to consider:
1: the value you should to put in 'user-data-dir' is the same you can find out in the route chrome://version/ in Google Chrome. Let me explain that with a picture (at the end of this answer).
ChromeOptions options = new ChromeOptions();
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
options.addArguments("user-data-dir=/Users/YourUser/Library/Application Support/Google/Chrome/Profile 1");
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
​And afterward you need to add this options to your Driver:
driver = new ChromeDriver(capabilities);
So, this is the best way to make request to a page that has Vector smash protection enabled.
Sorry but I can't spent time but the following was printed on my bash terminal.
Vector smash protection is enabled.
Failed to open VDPAU backend libvdpau_va_gl.so: cannot open shared object file: No such file or directory
Failed to open VDPAU backend libvdpau_va_gl.so: cannot open shared object file: No such file or directory
Failed to open VDPAU backend libvdpau_va_gl.so: cannot open shared object file: No such file or directory
...

Selenium Grid2: Timeout on requesting a new session

I have been hitting this issue from Selenium Grid2 since 2.41.0 or earlier. Currently I am using 2.44.0. The way I set up was having a node (running on Windows7) with maxSession to be 16, and a hub running on Linux. After the setup is done, I can see from the Grid/console that there were 16 icons available, which is expected. But when I kicked out tests which require more than 6 browser instances (in this case, Chrome browser), and I can see from the grid/console there were 6 icons grayed-out, and some message saying that there were also some "requests waiting for a slot to be free": https://selenium.googlecode.com/issues/attachment?aid=63970009000&name=Screen+Shot+2014-11-13+at+12.10.46+PM.png&token=ABZ6GAd1E0jC2GEYFnemYyFfc8n9RA9uYQ%3A1416429465010&inline=1.
And from the log, here I found:
WebDriverException: Message: Error forwarding the new session Request timed out waiting for a node to become available.
Does anyone know how to resolve this? Many thanks in advance.
There are configuration options for max instances of each browser type as well as the overall max number of instances.
Could your configuration be limiting the number of Chromes to 6?