1

I get the following code to open chromedriver with extension but this extension is disabled, Is there any way that when chrome is launched, it launch with enabled extension -

 chrome_options = Options()
 chrome_options.add_extension('C:\Python\extension_3_19_6_0.crx')

 driver = webdriver.Chrome(chrome_options=chrome_options)
 driver.get("http://stackoverflow.com")

1 Answer 1

1

I believe the line you are looking for is something like this:

String pathToExtension = 
“C:\\Users\\home\\AppData\\Local\\Google\\Chrome\\User 
Data\\Default\\Extensions\\mbopgmdnpcbohhpnfglgohlbhfongabi\\2.3.1_0”;
ChromeOptions options = new ChromeOptions();
options.addArguments(“–load-extension=” + pathToExtension);

Here is an excellent guide on this topic: https://seleniumjava.com/2016/05/22/start-the-chrome-browser-with-extensions/

1
  • 1
    It's actually --load-extension= i.e. with two dashes rather than one. Also, to load more than one extension at the same time, don't repeat the option, but rather separate several paths with a comma, like --load-extension=foo,bar,baz
    – geert3
    Oct 11, 2018 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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