Selenium for testing browser plugins

0 votes
I have a webapp with browser plugins for firefox and chrome. Currently, my tests are created through Selenium IDE. Is it also possible to install, activate, and delete browser plugins for firefox and chrome using selenium (maybe with other browsers too)?

The biggest challenge now is that to install/ enable the plugin, I have to restart the browser, and I'm not sure if its possible without selenium. The plugin can be easily handled by visiting an internal site-link to a php-script that detects your browser.
Apr 18, 2018 in Selenium by kappa3010
• 2,020 points
175 views

1 answer to this question.

0 votes

Yup..Installing browser plugins is possible with Selenium. With Chrome and Firefox, WebDriver supports the installation of extensions, remotely. Sample code is below for Chrome and Firefox:

For Chrome

File file = new File("extension.crx"); // zip files are also accepted
ChromeOptions options = new ChromeOptions();
options.addExtensions(file);

// Option 1: Locally.
WebDriver driver = new ChromeDriver(options);

// Option 2: Remotely
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capabilities);

For Firefox

File file = new File("extension.xpi");
FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.addExtension(file);

// Option 1: Locally
WebDriver driver = new FirefoxDriver(firefoxProfile);

// Option 2: Remotely
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability(FirefoxDriver.PROFILE, firefoxProfile);
WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capabilities);
answered Apr 18, 2018 by king_kenny
• 3,650 points

Related Questions In Selenium

0 votes
1 answer

Browser compatibility with selenium for testing forms

To use the old Selenium IDE you need Firefox ...READ MORE

answered Aug 6, 2018 in Selenium by Samarpit
• 5,130 points
51 views
0 votes
3 answers

Scripting Languages used with Selenium tool for Automation Testing

The biggest advantage of Selenium is that ...READ MORE

answered Aug 28 in Selenium by Abha
• 22,960 points
185 views
0 votes
1 answer

Error: FF Browser not working for Selenium test after update

Since Firefox's latest update to version 47.0, ...READ MORE

answered Apr 20, 2018 in Selenium by king_kenny
• 3,650 points
90 views
0 votes
1 answer

How do i click on <input type=file> on any browser if i'm testing with Selenium Webdriver?

Does not matter which OS or which ...READ MORE

answered Apr 29, 2018 in Selenium by king_kenny
• 3,650 points
2,992 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,090 points
559 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
892 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
558 views
0 votes
1 answer
0 votes
1 answer

Selenium Alternatives: Is there a tool like Selenium for testing web pages but which does not involve coding.

I'm guessing you've tried Selenium IDE already. ...READ MORE

answered Apr 13, 2018 in Selenium by king_kenny
• 3,650 points
68 views