1

如果我想将参数传递给选项,我正在尝试使用 seleniumwire 连接到网站,这是正确的方式吗?因为它在代理部分旁边对我不起作用。

我希望隐藏浏览器,并且应该隐藏我为 USB 获得的所有错误。

[14112:12440:0819/163127.876:ERROR:device_event_log_impl.cc(214)] [16:31:27.876] USB: usb_service_win.cc:201 Failed to get device address: Element not found. (0x490)
[14112:12440:0819/163127.880:ERROR:device_event_log_impl.cc(214)] [16:31:27.880] Bluetooth: bluetooth_adapter_winrt.cc:1073 Getting Default Adapter failed.

这是我的选择

options = {
    'proxy': {
        'http': 'http://' + proxy_user + ':' + proxy_pass + '@' + proxy_url + ':' + proxy_port, 
        'https': 'https://' + proxy_user + ':' + proxy_pass + '@' + proxy_url + ':' + proxy_port,
        'no_proxy': 'localhost,127.0.0.1' # excludes
    },
    'add_experimental_option': {
        'excludeSwitches': 'enable-logging'
    },
    'add_argument': '-headless'
}
4

1 回答 1

0

您可以通过这种方式传递参数。

options = webdriver.ChromeOptions()
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--ignore-certificate-errors-spki-list')
options.add_argument('--ignore-ssl-errors')
于 2021-09-18T03:12:03.963 回答