Selenium 2.53 or 2.48 not working in Firefox 48.0

2020-02-14 04:49发布

问题:

I am getting an error in Firefox 48.0 in new the update from firefox 47

Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output: 066 addons.xpi DEBUG Updating database with changes to installed add-ons

My system and browser configuration are:

Firefox 48

Selenium 2.48 also try 2.53

Window 8 64bit

I also tried the marionette driver but did not receive proper output with that.

Any ideas on how to fix this besides downgrading firefox?

回答1:

Older versions of Selenium (like 2.5.x) do not work and won't work with Firefox 48+. The reason is that Firefox 48 changed a lot of stuff, including the fact that extensions must be signed by Mozilla to work with Firefox. To fix the Selenium issue, Mozilla took ownership of FirefoxDriver() and they a released a Marionette version for this, including a Gecko driver.

This is what you need to use to be able to execute your tests on Firefox 48+.



回答2:

I would recommend downloading firefox 46 which seems to be the best match for selenium 2.53.x.

https://ftp.mozilla.org/pub/firefox/releases/46.0.1/win64/en-US/

Once I downgraded to firefox 46.0.1 everything was working as expected.



回答3:

I found another solution for my question with Firefox 48 and Selenium 3.0.0(Beta 3) because Selenium 2.48 didn't work.

If you want run selenium script then you have to download....

Selenium 3.0.0(Beta 3) - http://www.seleniumhq.org/download/

GeckoDriver exe - http://www.seleniumhq.org/download/

put below code in your script

public class FirefoxTest{

    public static void main(String args[]) throws InterruptedException{

    System.setProperty("webdriver.gecko.driver", "Path + geckodriver.exe");
    //For E.g ("webdriver.gecko.driver", "C://geckodriver.exe")

    DesiredCapabilities capabilities = DesiredCapabilities.firefox();
    capabilities.setCapability("marionette",true);
    WebDriver driver = new FirefoxDriver(capabilities);
    String baseUrl = "https://www.google.com";
    driver.get(baseUrl);

    }   
}