Home > Java > javaTutorial > body text

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

Susan Sarandon
Release: 2024-11-11 10:10:03
Original
481 people have browsed it

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.
Copy after login

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");
Copy after login

Utilize the WebDriverManager library to automate this process:

<dependency>
    <groupId>io.github.bonigarcia</groupId>
    <artifactId>webdrivermanager</artifactId>
    <version>5.1.0</version>
</dependency>
Copy after login
WebDriverManager.firefoxdriver().setup();
Copy after login

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
    }
}
Copy after login

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.

The above is the detailed content of Why Does Selenium 2.53.0 Encounter a Connection Error When Using Firefox 47?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template