How to launch Unpacked chrome extension in selenium?

In this article, we will provide a tip on how to launch Unpacked chrome extension in selenium.

Chrome extensions can either be bundled or unpacked. Packed that are bundled extensions are a single file with a .crx extension. Unpacked extensions are a directory that contains the extension. To unzip a bundled extension, just unzip the file.

We can run the Chrome browser by  using the below set of lines in selenium

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

Leave a Reply