USB: usb_device_handle_win.cc:1020 无法从节点连接错误中读取描述符 ChromeDriver v87 / Chrome v87 在 Windows10 上使用 Selenium

2024-02-07

我们最近升级了我们的Windows 10使用 ChromeDriver v87.0.4280.20 和 Chrome v87.0.4280.66(官方版本)(64 位)的测试环境,升级后,即使是最小的程序也会生成此错误日志:

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

最小代码块:

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/')

控制台输出:

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)

有人面临同样的情况吗? ChromeDriver/Chrome v87 相对于 ChromeDriver/Chrome v86 是否有任何变化?

任何线索都会有所帮助。


但是,可以通过简单的方法禁止这些日志消息出现在控制台上hack即通过添加一个参数add_experimental_option()如下:

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

代码块:

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/')
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

USB: usb_device_handle_win.cc:1020 无法从节点连接错误中读取描述符 ChromeDriver v87 / Chrome v87 在 Windows10 上使用 Selenium 的相关文章

随机推荐