When I run atomated tests with WebDriver using Chrome browser there is only one extension displayed on the page chrome://extensions/ - Chrome Automation Extension:

chrome automation extension

But there some more extensions installed which could be seen when chrome is not run under WebDriver.

Is there any way to allow usage of browser extensions also under WebDriver?

Version of Chrome is the same under WebDriver and without WebDriver, it is 67.0.3396.99

  • @AlexeyR. , that Q&A describes how to install/uninstall extension while running webdriver tests. I need the extension to be already installed (actually visible while running under WebDriver because it is already installed for Chrome). I do not test extension installation, just need to use it Jul 23, 2018 at 11:47
  • 1
    When you run browser using webdriver you run it with empty profile with no extensions installed so you will not see any extension that you normally see when run your browser manually under your profile. Hence you should install them for each run
    – Alexey R.
    Jul 23, 2018 at 12:05
  • 1
    Probably this one will also give you a clue stackoverflow.com/questions/14480717/…
    – Alexey R.
    Jul 23, 2018 at 12:24

2 Answers 2


General idea (as it was pointed by @AlexeyR. & @kirbycope) is to use Chrome Profile with already defined setting & plug-ins. Here I'm going to describe some underwater rocks of this solution.

So first of all, we create WebDriver with ChromeOptions:

    String username = System.getProperty("user.name");
    String chromeProfile = "C:\\Users\\" + username + "\\AppData\\Local\\Google\\Chrome\\AutomationProfile";

    ChromeOptions options = new ChromeOptions();
    options.addArguments("user-data-dir=" + chromeProfile);
    // 'disable-default-apps' is added by default and needs to be removed because it disables plugin I use
    options.setExperimentalOption("excludeSwitches", Arrays.asList("disable-default-apps"));

    System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir") + "\\resources\\chromedriver.exe");
    webDriver = new ChromeDriver(options);

Rock #1: WebDriver failes on initialization if default chrome profile is used and chrome is already opened (are you going to close all your browser windows all the time when you run test? :) ). To avoid this you should set Chrome profile to e.g. ...Chrome\AutomationProfile (all files from ...Chrome\User Data (default profile) are copied to that folder with an exception of file ...Chrome\User Data\Default\Current Tabs - you don't need to open last tabs from the user profile)

Rock #2: by default WebDriver adds Chrome Option --disable-default-apps which disabled plug-in I need, so be prepared to remove/add options you need (check them with the link chrome://version/ - see Comand line)

Rock #3: If you use library you can not apply ChromeOptions to configuration (check issue 'Are not added capabilities from Configuration.browserCapabilities'). So there is a workaround for this issue to define WebDriver manually as described above and pass it to Selenide with method com.codeborne.selenide.WebDriverRunner.setWebDriver:


If you want Chrome to run using your extensions, then you can run Chrome using that "profile". Here is copy+paste of my answer from another question here on SQA:

// Create an options object to specify command line arguments for the Chrome web driver
ChromeOptions options = new ChromeOptions();
// Use a real profile so that all components load
string localAppData = Environment.GetEnvironmentVariable("LocalAppData");
options.AddArgument(@"user-data-dir=" + localAppData + @"\Google\Chrome\User Data\");
// Allow components to update (some components will not load if out of date)
  • 1
    Please do not copy-paste your answers. Better vote for closing questions as duplicate. This will probably make you gaining less upvotes (not sure though) but that will definitely increase the overall value and quality of the community
    – Alexey R.
    Jul 23, 2018 at 19:55

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.