how_do_i_do_dis
how_do_i_do_dis

Reputation: 31

Firefox Webdriver unable to launch with extension

I am using Selenium 3.3.1 and geckodriver v0.15.0 and Firefox 51.0.1 (32-bit). I want to start the Firefox with an unsigned browser extension. I managed to do this in Chrome, but Firefox is giving me some troubles. The code I have to run the webdriver:

    public void startWebDriver (String browser) {
    if (browser == "Chrome") {
        ChromeOptions options = new ChromeOptions();
        options.addArguments("--enable-devtools-experiments");
        options.addExtensions(new File(pathToChromeExtension));
        DesiredCapabilities capabilities = new DesiredCapabilities ();
        capabilities.setCapability(ChromeOptions.CAPABILITY, options);
        driver = new ChromeDriver(capabilities);
    }

    else if (browser == "Firefox") {
        System.setProperty("webdriver.gecko.driver", "c:\\Users\\...geckodriver.exe");
        FirefoxProfile firefoxProfile = new FirefoxProfile();
        String addonPath;
        addonPath = "\\whatever\\path\\to\\extension.xpi";
        File addonFile  = new File(addonPath);
        firefoxProfile.addExtension(addonFile);
        driver = new FirefoxDriver(firefoxProfile);
    }

and when I run this, I receive following error:

org.openqa.selenium.WebDriverException: Unable to convert: Capabilities [{moz:firefoxOptions={binary=Optional.empty, args=[], legacy=null, logLevel=null, prefs={}, profile=org.openqa.selenium.firefox.FirefoxProfile@57a78e3}, firefox_profile=org.openqa.selenium.firefox.FirefoxProfile@57a78e3}]

I tried to find similair questions here/on the interwebs in general, but could not find anything really relevant...

What am I doing wrong? Is it even possible to make Firefox load an unsigned addon? Please note that I need to add this extension as a "Temporary addon", because it doesnt have signatures etc...

Any reply appreciated! :)

Cheers

Upvotes: 1

Views: 1158

Answers (2)

Basilevs
Basilevs

Reputation: 23896

Use Firefox Developer edition to be able to install unsigned extensions.

How can I disable signature checking for Firefox add-ons?

Upvotes: 1

Lucas Tierney
Lucas Tierney

Reputation: 2563

I believe Firefox stopped allowing unsigned extensions starting at version 48, see mozilla.org/en-US/firefox/48.0/releasenotes

Upvotes: 0

Related Questions