[英]Selenium webdriver dns_config_watch_failed and usb not functioning Python
我正在使用 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")
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_dir
是要下载到的目录。 该脚本运行良好,但在开始时有 2 x 错误消息:
: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)
如何解决这些错误?
更新
Debanjanb在此处提供了USB 错误的详细解决方案。 这应该会在以后的更新中尽快解决。
对于 DNS 错误,这里是指向源文档dns_config_service_winc.cc及以下 function 产生错误的链接:
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);
}
仍然不确定 DNS_CONFIG_WATCH_FAILED_CONFIG 是否会带来安全风险。
pcalkins建议有效 - 删除options.add_argument("--allow-running-insecure-content")
这解决了 DNS 错误消息。 较新的 chrome 版本也旨在解决 USB 错误消息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.