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,090 points
2,145 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,710 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,910 points
564 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, 2019 in Selenium by Abha
• 28,140 points
4,274 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 21, 2018 in Selenium by king_kenny
• 3,710 points
1,133 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,710 points
10,302 views
0 votes
2 answers

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,500 points
12,617 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
8,572 views
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,910 points
6,629 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,519 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,710 points
569 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP