The Selenium documentation mentions that the Chrome webdriver can take an instance of ChromeOptions, but I can't figure out how to create ChromeOptions.

I'm hoping to pass the --disable-extensions flag to Chrome.

    Found the chrome Options class in the Selenium source code.

    Usage to create a Chrome driver instance:

    from selenium import webdriverfrom import Optionschrome_options=Options()chrome_options.add_argument("--disable-extensions")driver=webdriver.Chrome(chrome_options=chrome_options)
    • 4
      This answer was a lifesaver. In case it's useful to others, to enable ES6 Harmony features, the call is chrome_options.add_argument("--js-flags=--harmony")– msridharJun 18 '14 at 0:04

    This is how I did it.

    from selenium import webdriverchrome_options=webdriver.ChromeOptions()chrome_options.add_argument('--disable-extensions')chrome=webdriver.Chrome(chrome_options=chrome_options)

      Code which disable chrome extensions for ones, who uses DesiredCapabilities to set browser flags :

      desired_capabilities['chromeOptions']={"args": ["--disable-extensions"],"extensions": []}webdriver.Chrome(desired_capabilities=desired_capabilities)

        Your Answer


        By posting your answer, you agree to the privacy policy and terms of service.

        Not the answer you're looking for? Browse other questions tagged or ask your own question.