【发布时间】:2021-04-13 15:24:08
【问题描述】:
我正在使用 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 Error的详细解决方案。这应该会在以后的更新中尽快解决。
对于 DNS 错误,这里是指向源文档dns_config_service_winc.cc 的链接以及产生错误的以下函数:
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 是否存在安全风险。
【问题讨论】:
-
删除“--allow-running-insecure-content”以查看错误是否消失。 (这可能与 Chrome 中关于混合内容的一些相当近期的变化有关……http/https)
-
谢谢@pcalkins。你的解决方案奏效了。我只是浏览了更多文档,USB 消息大多发生在 Windows 上,不会从版本 90 开始显示。
标签: python selenium google-chrome dns driver