Download a Firefox extension (add-on) without installing it

4k views Asked by At

How can I download a Firefox extension (add-on) without having it automatically installed?

Here is the problem in details:

I am using Selenium web-driver in order to do some "web-testing" stuff.

I need the Lightbeam plugin to be available on the Firefox instance that I create with Selenium.

The method (in Java) is simple:

FirefoxProfile profile = new FirefoxProfile();
profile.addExtension(new File("lightbeam.xpi"));
WebDriver webDriver = new FirefoxDriver(profile);

But I cannot find a way to download the file 'lightbeam.xpi' without having it automatically installed...

Alternatively, you can tell me where to look for the XPI file after the installation is complete.

I have not been able to find it, and I suspect that it is deleted immediately upon completion.

Thanks

1

There are 1 answers

0
nmaier On BEST ANSWER

E.g. for Lightbeam go to the website and right click Add to Firefox and select Save Link As... This should work for all addons.mozilla.org hosted add-ons and most non-mozilla hosted ones. If it does not for some site, you might have luck sniffing out the XPI location via the Web Console/Network tab and/or Browser Console.

To get XPIs for already installed add-ons, open about:support in a tab and click the Show in Finder/*Show Folder* or whatever that button says in your OS.

There will be an extensions subdirectory where all non-global extensions are located. You usually can copy any *.xpi files without problem.

There might be some extensions that are unpacked (are a subdirectory). You usually can re-zip these subdirectories with your favorite zip tool, but you have to make sure the zip does contain the files flat (/install.rdf not somesubdir/install.rdf).

For some add-ons copying *.xpi around or re-packing XPIs might not work. You'll have to get the original XPI then.

Those already installed add-ons might have funky file/directory names. This is the add-on ID, which is either a GUID (old school) or an @-address (newer style). about:support contains a table telling you the names corresponding to add-on IDs.