0

Selenium webdriver using firefox

System.setProperty("webdriver.firefox.marionette", "c:\\geckodriver-0.24.0-win64.exe");
WebDrier driver = new FirefoxDriver();
driver.get("http://localhost/index.html");

The browser is opened, but page can not be loaded.Error: Caused by:

    org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:45855/hub/status] to be available after 45002 ms

        Caused by:
        java.util.concurrent.TimeoutException
eastwater
  • 4,624
  • 9
  • 49
  • 118

2 Answers2

0

Change the first line as below.

System.setProperty("webdriver.gecko.driver","c:\geckodriver-0.24.0-win64.exe");

supputuri
  • 13,644
  • 2
  • 21
  • 39
0

To eliminates lot of manual works and incompatibility issues, I would suggest you to go for WebDriverManager as it automatically downloads required binary and we do not need to set any path.

It supports browsers such as Chrome, Firefox, Microsoft Edge, or Internet Explorer.

Please add below dependency

<dependency>
    <groupId>io.github.bonigarcia</groupId>
    <artifactId>webdrivermanager</artifactId>
    <version>3.1.1</version>
</dependency>

Now you can open firefox writing code in below way

WebDriverManager.firefoxdriver().setup();
FirefoxOptions fOptions = new FirefoxOptions();
fOptions.addArguments("start-maximized");
driver = new FirefoxDriver(fOptions);
TheSociety
  • 1,936
  • 2
  • 8
  • 20