Deb*_*anB 10 python selenium google-chrome selenium-chromedriver webusb
我们最近使用 ChromeDriver v87.0.4280.20 和 Chrome v87.0.4280.66(官方版本)(64 位)升级了我们的Windows 10测试环境,升级后即使是最小的程序也会产生此错误日志:
[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)
Run Code Online (Sandbox Code Playgroud)
最小代码块:
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/')
Run Code Online (Sandbox Code Playgroud)
控制台输出:
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)
Run Code Online (Sandbox Code Playgroud)
有人面临同样的问题吗?ChromeDriver/Chrome v87 相对于 ChromeDriver/Chrome v86 有什么变化吗?有什么线索吗?
Deb*_*anB 22
但是,可以通过简单的hack来禁止这些日志消息出现在控制台上,即通过添加参数,add_experimental_option()如下所示:
options.add_experimental_option('excludeSwitches', ['enable-logging'])
Run Code Online (Sandbox Code Playgroud)
代码块:
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/')
Run Code Online (Sandbox Code Playgroud)
Rei*_*ant 15
我为日志垃圾邮件道歉。如果您在使用 WebUSB 连接到设备时没有问题,您可以忽略这些警告。它们由 Chrome 尝试读取当前挂起的 USB 设备的属性触发。
Deb*_*anB 12
经过多次讨论,这里的文档和 Chromium 问题是与日志消息显示相关的详细信息:
[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)
Run Code Online (Sandbox Code Playgroud)
这一切都始于报告铬问题在 Windows 上删除 WebUSB 对 libusb 的依赖为:
当插入硬件并且系统未知 VID/PID 时,Windows 10 会正确加载 CDC 部分的 CDC 驱动程序和 WebUSB 部分的 WinUSB 驱动程序(版本 10)(无红旗)。但是,在我在界面上手动强制使用较旧的 WinUSB 驱动程序(版本 6 - 可能也已修改)之前,chrome 似乎从未找到该设备。
该解决方案分步实施,如下所示:
这些更改确保新后端已准备好进行测试,并可通过Chrome Canary和 chrome-dev-channel 使用,您可以通过以下方式手动访问:
chrome://flags#enable-new-usb-backend
Run Code Online (Sandbox Code Playgroud)
提交的更多变更请求如下:
由于新后端的实验性发布似乎是稳定的,最终这些配置默认启用,以便通过USB向所有Chrome 87用户推出更改:默认启用新的 Windows USB 后端。修订/提交
我们的想法是,一旦此配置成为一些里程碑的默认配置,Chromium 团队将开始从旧后端删除特定于 Windows 的代码并删除标志。
Chromium 团队已经在Chrome v90中合并了修订/提交以扩展 new-usb-backend 标志到期,这将很快可用。
根据@ReillyGrant的 [Committer, WebDriver for Google Chrome]评论:
......“最好降低这些消息的日志级别,这样它们默认不会出现在控制台上,但我们还没有登陆代码来做到这一点”......
您可以在以下位置找到一些相关的详细讨论:
| 归档时间: |
|
| 查看次数: |
33051 次 |
| 最近记录: |