Reputation: 35
Using Selenium 3.1.0, firefox latest version 72.0, default firefox driver 2.53.1 here is my code
System.setProperty("webdriver.gecko.driver" ,"C:\\Users\\sindhusha.tummala\\Downloads\\geckodriver.exe");
driver = new FirefoxDriver();
Still i am getting the error
org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(C:\Program Files\Mozilla Firefox\firefox.exe) on port 7055;
Could any one help with this
Upvotes: 1
Views: 700
Reputation: 193338
This error message...
org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(C:\Program Files\Mozilla Firefox\firefox.exe) on port 7055;
...implies that the GeckoDriver binary (executable) was unable to initiate/spawn a new Browsing Context i.e. Firefox Browser session as it was unable to locate the FirefoxBinary.
This issue arises when Firefox is not installed at the default location or is not installed at all.
To solve this issue:
firefox_binary
as follows:Code block:
public class A_Firefox_binary
{
public static void main(String[] args)
{
System.setProperty("webdriver.gecko.driver", "C:/Utility/BrowserDrivers/geckodriver.exe");
FirefoxOptions options = new FirefoxOptions();
options.setBinary("C:\\path\\to\\firefox.exe");
WebDriver driver = new FirefoxDriver(options);
driver.get("https://stackoverflow.com");
System.out.println("Page Title is : "+driver.getTitle());
driver.quit();
}
}
Ensure that:
Test
as a non-root user.driver.quit()
within tearDown(){}
method to close & destroy the WebDriver and Web Client instances gracefully.You can find a couple of relevant discussions in:
Upvotes: 1