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 selenium.webdriver.chrome.options import Optionschrome_options=Options()chrome_options.add_argument("--disable-extensions")driver=webdriver.Chrome(chrome_options=chrome_options)
    • 5
      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 clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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