Reputation: 890
I am developing test automation using Selenium with Java. I would like to install/add extension to chrome instance launched through Selenium. One way to install/add extension is using .crx file as follow.
ChromeOptions options = new ChromeOptions();
options.addExtensions(new File(ext_path));
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
driver = new ChromeDriver(capabilities);
But I would like to install/add extension from Chrome Web Store. Can anyone please suggest how to achieve this. Thanks.
Upvotes: 1
Views: 3486
Reputation: 1
You can install extension (packed/unpacked) to chrome with options.addExtensions/addArguments
as mentioned here:- https://sites.google.com/a/chromium.org/chromedriver/extensions
alternative: Chromedriver
every time opens new chrome instance with temporary profile for the execution. To avoid this you can use existing profile with desired chrome extension installed OR you can send commands to already running instance of chrome which has desir d extension installed.
usually, inline/webstore installation of a Chrome extension can't be tested with ChromeDriver
/Selenium
alone, because of confirmation dialog.
you can use platform-specific hacks to click on the button (e.g. via AutoIt),
Upvotes: 0