Automated tests with Selenium are awesome, but how to do them on headless Firefox with a pre-installed extension?
I found this for Chrome, but nothing for Firefox
How to install an extension to FF?
Automated tests with Selenium are awesome, but how to do them on headless Firefox with a pre-installed extension?
I found this for Chrome, but nothing for Firefox
How to install an extension to FF?
I don't know the language you are using, but if you have the xpi file handy you can install (or rather enable it like this)
this is a javascript way, but all selenium drivers work the same (look for the profile part)
let binary;
switch (channel) {
case 'nightly':
binary = new firefox.Binary(firefox.Channel.NIGHTLY);
break;
case 'beta':
binary = new firefox.Binary(firefox.Channel.BETA);
break;
default:
binary = new firefox.Binary(firefox.Channel.RELEASE);
}
binary.addArguments('-headless');
let options = new firefox.Options();
options.setBinary(binary);
let profile = new firefox.Profile();
profile.addExtension(path.join(__dirname, '[email protected]'));
options.setProfile(profile);
driver = new webdriver.Builder()
.forBrowser('firefox')
.setFirefoxOptions(options)
.build();
Best thing is to use some thing like Xvfb . And run firefox in headless mode. http://tobyho.com/2015/01/09/headless-browser-testing-xvfb/
now you can install any chrome extension to Firefox. here is the solution. How to install chrome extension to firefox?
You can install add-on globally via command line using (e.g. on my Ubuntu):