Extensions installed on chrome browser missing when chrome browser instance is opened with Selenium chromeDriver

You have to install each extension you want to use. In Selenium2 C# API it looks like this

var options = new ChromeOptions();
options.AddExtension(Path.GetFullPath("local/path/to/extension.crx"));
var driver = new ChromeDriver(options);

and the extension will be in the browser. Reference for java can be found here. See this question for how to obtain the .crx file for your extension from the chrome store.


this answer can be found here https://sites.google.com/a/chromium.org/chromedriver/extensions. Chrome extensions can be either packed or unpacked. Packed extensions are a single file with a .crx extension. Unpacked extensions are a directory containing the extension, including a manifest.json file.

To pack an unpacked extension, use the Pack button in chrome://extensions or use Chrome: "chrome.exe --pack-extension=C:\path\to\unpacked\extension --pack-extension-key=C:\myext.pem". See the extensions docs for other ways to do this that are more automation friendly. To unpack a packed extension, just unzip the file (you may need to rename the file from .crx to .zip for your zip utility to recognize it). Installing extensions via ChromeDriver

Packed (.crx file)

ChromeOptions options = new ChromeOptions();
options.addExtensions(new File("/path/to/extension.crx"));
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
ChromeDriver driver = new ChromeDriver(capabilities);

Unpacked (directory)

ChromeOptions options = new ChromeOptions();
options.addArguments("load-extension=/path/to/extension");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
ChromeDriver driver = new ChromeDriver(capabilities);

If you want to have the extension available during testing you need to start chrome with a profile that defines this extension or give the extension as desired property to the webdriver. Usually, when you start chrome via webdriver the chrome starts with a fresh profile each time.

so if you want to load an extension in the test chrome, do this:

 DesiredCapabilities capabilities = DesiredCapabilities.chrome();
 capabilities.setCapability("chrome.switches", 
    Arrays.asList("--load-extension=/path/to/extension/directory"));
 WebDriver driver = new ChromeDriver(capabilities);

More info about the matter can be found here