Home > Java > javaTutorial > Why Does Selenium 2.53.0 Encounter a 'NotConnectedException' with Firefox 47.0?

Why Does Selenium 2.53.0 Encounter a 'NotConnectedException' with Firefox 47.0?

Mary-Kate Olsen
Release: 2024-11-14 11:06:02
Original
393 people have browsed it

Why Does Selenium 2.53.0 Encounter a

FirefoxDriver Compatibility with Selenium 2.53

When using Selenium WebDriver 2.53.0 with Firefox 47.0, an error like the following may occur:

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

This issue arises due to the incompatibility of Selenium WebDriver 2.53.0 with Firefox 47.0. The discontinued FirefoxDriver component, which handled Firefox browsing, has been replaced with the need for the geckodriver binary to manage Firefox browsers in Selenium WebDriver 3.0 and later.

Solution:

To address this problem, follow these steps:

  1. Download GeckoDriver: Get the Firefox driver binary (geckodriver) compatible with your system from here.
  2. Set System Property: Export the absolute path to the geckodriver binary as a system property named "webdriver.gecko.driver":
System.setProperty("webdriver.gecko.driver", "/path/to/geckodriver");
Copy after login

Alternatively, you can use the WebDriverManager library to simplify the process:

  1. Add Dependency: Include the following dependency in your project's pom.xml file:
<dependency>
    <groupId>io.github.bonigarcia</groupId>
    <artifactId>webdrivermanager</artifactId>
    <version>5.1.0</version>
</dependency>
Copy after login
  1. Setup GeckoDriver: Execute the following line before using WebDriver:
WebDriverManager.firefoxdriver().setup();
Copy after login

Note:

  • Marionette will eventually become the sole option for browser management in future releases of Selenium WebDriver and Firefox.
  • Selenium WebDriver 2.53.1, released on June 30, 2016, resolved the issue, allowing FirefoxDriver to work again with Firefox 47.0.1.

The above is the detailed content of Why Does Selenium 2.53.0 Encounter a 'NotConnectedException' with Firefox 47.0?. 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