Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium 2.53 not working on Firefox 47

I am getting error while using Firefox with WebDriver.

org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. 
  • Firefox version:47.0
  • Selenium:2.53.0
  • Windows 10 64 bit

Is anyone getting a similar issue or any idea what is the solution for this? It's working fine with Chrome but with Firefox none of the URLs are getting loaded.

like image 444
veena k Avatar asked Jun 08 '16 04:06

veena k


People also ask

Which version of Firefox is compatible with Selenium?

FireFox was fully supported only in previous versions i.e. v47 and earlier. Selenium WebDriver version 2.53 is not compatible with Mozilla FireFox version 47.0+. After v47. 0, FireFox is provided with GeckoDriver.

Which version of Firefox is compatible with Gecko driver?

Gecko driver works with Firefox version 47 or above. It can be resolved by updating Firefox version to 47 or above.

Does Selenium work with Firefox?

Mozilla Firefox is one of the most widely used browsers in the world. It has enhanced features and is supported by a multitude of the latest testing tools and techniques. One such tool is Selenium. Selenium uses Firefox Driver to link the test cases with the Firefox browser.


1 Answers

Unfortunately Selenium WebDriver 2.53.0 is not compatible with Firefox 47.0. The WebDriver component which handles Firefox browsers (FirefoxDriver) will be discontinued. As of version 3.0, Selenium WebDriver will need the geckodriver binary to manage Firefox browsers. More info here and here.

Therefore, in order to use Firefox 47.0 as browser with Selenium WebDriver 2.53.0, you need to download the Firefox driver (which is a binary file called geckodriver as of version 0.8.0, and formerly wires) and export its absolute path to the variable webdriver.gecko.driver as a system property in your Java code:

System.setProperty("webdriver.gecko.driver", "/path/to/geckodriver"); 

Luckily, the library WebDriverManager can do this work for you, i.e. download the proper Marionette binary for your machine (Linux, Mac, or Windows) and export the value of the proper system property. To use this library, you need to include this dependency into your project:

<dependency>     <groupId>io.github.bonigarcia</groupId>     <artifactId>webdrivermanager</artifactId>     <version>5.1.0</version> </dependency> 

... and then execute this line in your program before using WebDriver:

WebDriverManager.firefoxdriver().setup(); 

A complete running example of a JUnit 4 test case using WebDriver could be as follows:

public class FirefoxTest {      protected WebDriver driver;      @BeforeClass     public static void setupClass() {         WebDriverManager.firefoxdriver().setup();     }      @Before     public void setupTest() {         driver = new FirefoxDriver();     }      @After     public void teardown() {         if (driver != null) {             driver.quit();         }     }      @Test     public void test() {         // Your test code here     } } 

Take into account that Marionette will be the only option for future (for WebDriver 3+ and Firefox 48+), but currently (version 0.9.0 at writing time) is not very stable. Take a look to the Marionette roadmap for further details.

UPDATE

Selenium WebDriver 2.53.1 has been released on 30th June 2016. FirefoxDriver is working again with Firefox 47.0.1 as browser.

like image 57
Boni García Avatar answered Oct 08 '22 03:10

Boni García