Home  >  Article  >  Backend Development  >  How to Suppress "USB: usb_device_handle_win.cc:1020 Failed to Read Descriptor from Node Connection" Error in ChromeDriver v87?

How to Suppress "USB: usb_device_handle_win.cc:1020 Failed to Read Descriptor from Node Connection" Error in ChromeDriver v87?

Barbara Streisand
Barbara StreisandOriginal
2024-11-09 18:43:021005browse

How to Suppress

USB: usb_device_handle_win.cc:1020 Failed to Read Descriptor from Node Connection

In Windows 10 environments running Chrome v87 and ChromeDriver v87, a common error encountered is:

[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)

This error occurs during Selenium tests.

Cause

The issue stems from a change in ChromeDriver/Chrome v87 that enhances communication between the browser and USB devices.

Solution

While this error does not impact the test execution, excessive message logs clutter the console. To suppress these messages, an experimental option can be added to the ChromeDriver as:

options.add_experimental_option('excludeSwitches', ['enable-logging'])

Example

from selenium import webdriver

options = webdriver.ChromeOptions()
options.add_argument("start-maximized")
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/')

By excluding the enable-logging switch, the error messages can be hidden from the console without affecting test functionality.

The above is the detailed content of How to Suppress "USB: usb_device_handle_win.cc:1020 Failed to Read Descriptor from Node Connection" Error in ChromeDriver v87?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn