Python Selenium webdriver dns_config_watch_失败,usb无法正常工作
我使用chrome在windows10 Python 3.8.6上运行selenium webdriver。我不知道如何检查,但我想我使用的是chrome驱动程序版本88。在我的脚本中,我使用了以下Chrome选项:Python Selenium webdriver dns_config_watch_失败,usb无法正常工作,python,selenium,google-chrome,dns,driver,Python,Selenium,Google Chrome,Dns,Driver,我使用chrome在windows10 Python 3.8.6上运行selenium webdriver。我不知道如何检查,但我想我使用的是chrome驱动程序版本88。在我的脚本中,我使用了以下Chrome选项: options = Options() options.add_argument("--allow-running-insecure-content") options.add_argument("--start-maximized") pr
options = Options()
options.add_argument("--allow-running-insecure-content")
options.add_argument("--start-maximized")
prefs = {
"profile.default_content_settings.popups": 0,
"download.default_directory": fr"{dwnld_dir}",
"directory_upgrade": True,
}
options.add_experimental_option("prefs", prefs) # preferences set
options.add_argument("--ignore-certificate-errors")`:
其中dwnld\u dir
是要下载到的目录。脚本运行正常,但在开始时有2条错误消息:
:ERROR:dns_config_services_win.cc(785)] DNS config watch failed
:ERROR:device_event_log_impl.cc(211) [07:24:12.130] USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
如何解决这些错误
更新
这里提供了一个详细的解决方案。这应该在以后的更新中很快解决
对于DNS错误,这里是指向源文档的链接,下面是生成错误的函数:
void DnsConfigServiceWin::OnConfigChanged(bool succeeded) {
InvalidateConfig();
config_reader_->WorkNow();
if (!succeeded) {
LOG(ERROR) << "DNS config watch failed.";
set_watch_failed(true);
UMA_HISTOGRAM_ENUMERATION("AsyncDNS.WatchStatus",
DNS_CONFIG_WATCH_FAILED_CONFIG,
DNS_CONFIG_WATCH_MAX);
}
void DnsConfigServiceWin::OnConfigChanged(bool成功){
失效图();
config_reader_uu->WorkNow();
如果(!成功){
日志(错误)建议有效-删除选项。添加参数(“--allow running unsecure content”)
这将解决DNS错误消息。较新的chrome版本也旨在解决USB错误消息。删除--allow running unsecure content”以查看错误是否消失。(可能是关于这一点,以及Chrome最近在混合内容方面的一些变化……http/https)谢谢@pcalkins。你的解决方案奏效了。我刚刚浏览了更多的文档,USB消息主要发生在Windows上,在版本90中不会显示。