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.
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:
System.setProperty("webdriver.gecko.driver", "/path/to/geckodriver");
Alternatively, you can use the WebDriverManager library to simplify the process:
<dependency> <groupId>io.github.bonigarcia</groupId> <artifactId>webdrivermanager</artifactId> <version>5.1.0</version> </dependency>
WebDriverManager.firefoxdriver().setup();
Note:
Atas ialah kandungan terperinci Mengapa Selenium 2.53.0 Menghadapi "NotConnectedException" dengan Firefox 47.0?. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!