Failed to read descriptor from node connection: A device attached to the system is not functioning error using ChromeDriver Selenium on Windows OS
Solution 1
After a week of finding an answer to my error, I ended up with a solution that you just need to install pywin32 library and it will not gives you an error
open cmd and type
pip install pywin32
and you are good to go.....!
Solution 2
This is a chromedriver issue that they're still working the kinks out of. I'm not entirely sure what's causing it, but the technical details seem to be detailed in Debanjan's answer.
The general solution on the internet just seems to be "ignore it", but it sure clutters up the logs a lot.
I did find a way to get it to shut up though (as well as the "DevTools" warning that pops up a lot as well).
options = webdriver.ChromeOptions()
options.add_experimental_option('excludeSwitches', ['enable-logging'])
driver = webdriver.Chrome(options=options)
You can add your other chromedriver options and switches onto that as well, in addition to pointing to your chromedriver executable if you wish.
Solution 3
This error message...
[14432:11656:1120/161059.539:ERROR:device_event_log_impl.cc(211)] [16:10:59.539] USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
...implies that the ChromeDriver raised an error while in trying to initiate/spawn a new Browsing Context i.e. Chrome Browser session.
Analysis
This error occurs due to an USB device which is attached to the windows-10 system and isn't functioning properly.
This error is defined within usb_device_handle_win.cc as follows:
void UsbDeviceHandleWin::GotDescriptorFromNodeConnection(
TransferCallback callback,
scoped_refptr<base::RefCountedBytes> request_buffer,
scoped_refptr<base::RefCountedBytes> original_buffer,
Request* request_ptr,
DWORD win32_result,
size_t bytes_transferred) {
std::unique_ptr<Request> request = UnlinkRequest(request_ptr);
if (win32_result != ERROR_SUCCESS) {
SetLastError(win32_result);
USB_PLOG(ERROR) << "Failed to read descriptor from node connection";
std::move(callback).Run(UsbTransferStatus::TRANSFER_ERROR, nullptr, 0);
return;
}
Solution
This error isn't harmful and doesn't blocks the spawning of the new Browsing Context i.e. Chrome Browser session. So you can safely ignore the error.
However in your code block you need to replace the keyword resource_path
with executable_path
and your effective code block will be:
webdriver.Chrome(executable_path=r'C:\webdriver\chromedriver.exe') # to open the chromebrowser
driver.get("https://web.whatsapp.com")
References
You can find a couple of relevant detailed discussions in:
- USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection error with ChromeDriver v87 / Chrome v87 using Selenium on Windows10
- Failed to read descriptor from node connection: A device attached to the system is not functioning error using ChromeDriver Chrome through Selenium
Solution 4
Solution:
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
import time
options = Options()
options.add_experimental_option('excludeSwitches', ['enable-logging'])
driver = webdriver.Chrome(executable_path=r"D:\SW\chromedriver90\chromedriver.exe",chrome_options=options)
url = 'https://carlsagan.com/'
driver.get(url)
...
driver.quit()
Solution 5
The error is probably because you have used parenthesis in the resource_path variable. The code should be as following:
driver = webdriver.Chrome(resource_path="C:\webdriver\chromedriver.exe") # to open the chromebrowser
driver.get("https://web.whatsapp.com")
if still there is any problem you can try keeping the web driver in the same folder as the python file.
UMANG BARAIYA
Updated on August 21, 2021Comments
-
UMANG BARAIYA over 2 years
I got this while running the selenium webdriver script in python I also set the path in System Environment and also tried downloading the webdriver that matches with my chrome version. And also letest version also. But I still get this error:
[8552:6856:1120/155118.770:ERROR:device_event_log_impl.cc(211)] [15:51:18.771] USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F) [8552:6856:1120/155118.774:ERROR:device_event_log_impl.cc(211)] [15:51:18.774] USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F) [8552:6856:1120/155118.821:ERROR:device_event_log_impl.cc(211)] [15:51:18.821] USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
I used this in my code :
driver = webdriver.Chrome(resource_path("C:\\webdriver\\chromedriver.exe")) # to open the chromebrowser driver.get("https://web.whatsapp.com")