"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > Why Does Selenium 2.53.0 Encounter a Connection Error When Using Firefox 47?

Why Does Selenium 2.53.0 Encounter a Connection Error When Using Firefox 47?

Published on 2024-11-18
Browse:536

Why Does Selenium 2.53.0 Encounter a Connection Error When Using Firefox 47?

Selenium 2.53 Incompatibility with Firefox 47

While utilizing Selenium WebDriver 2.53.0, an error is encountered:

org.openqa.selenium.firefox.NotConnectedException: Unable to connect
to host 127.0.0.1 on port 7055 after 45000 ms.

Relevant System Information:

  • Firefox Version: 47.0
  • Selenium Version: 2.53.0
  • Operating System: Windows 10, 64-bit

Resolution

Selenium WebDriver 2.53.0 is incompatible with Firefox 47.0. As of version 3.0, Selenium WebDriver relies on the geckodriver binary for managing Firefox browsers.

To resolve the issue, download the Firefox driver (geckodriver). Set the system property "webdriver.gecko.driver" to the absolute path of the geckodriver binary in your Java code:

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

Utilize the WebDriverManager library to automate this process:

io.github.bonigarciawebdrivermanager5.1.0
WebDriverManager.firefoxdriver().setup();

Complete Example:

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() {
        // Test code goes here
    }
}

Note: Marionette is the recommended option for Firefox versions 48 and Selenium WebDriver 3 .

Update:

Selenium WebDriver version 2.53.1 has been released, restoring compatibility with Firefox 47.0.1.

Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3