Home > database >  Why does my Selenium webdriver instance not apply the options specified?
Why does my Selenium webdriver instance not apply the options specified?

Time:01-29

I'm trying to apply some options to my selenium webdriver instance. However, the options add_argument are not applied when testing my script:

    # Set service parameter for the driver
    s = Service(ChromeDriverManager().install())

    # Add options
    options = Options()
    options.add_argument("--start-maximized")
    options.add_argument("--disable-popup-blocking")
    options.add_argument("--disable-infobars")
    options.add_argument("--disable-notifications")
    options.add_experimental_option("prefs", {
        "download.default_directory": "/Users/jonas/Desktop/cherrypicks/screenshots",
        "download.prompt_for_download": False,
        "download.directory_upgrade": True,
    })

    # Initiate driver
    driver = webdriver.Chrome(service=s, options=options)

The experimental_option settings work though.

CodePudding user response:

Please check this out: Chrome-flags

disable-infobars is removed. You may have to enable-automation instead, but please go through the information provided before applying it, as it may disable some features that might not be suitable for automation.

start-maximized works as I tested it.

  •  Tags:  
  • Related