pythonseleniumwire

Python Seleniumwire How To Pass Arguments


I'm trying to use seleniumwire to connect to a website if i want to pass arguments to option is this right way? Because it is not working for me beside the proxy part.

I want the browser to be hidden and all the errors that i'm gettings for USB should be hidden.

[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.

Here my options

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'
}

Solution

  • You can pass the argument this way.

    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')