eclipseseleniumwebdrivereclipse-photon

Firefox is not launching URL through Selenium WebDriver


I am using Eclipse Photon, Firefox version 62.0 Quantum, Selenium 3.14.0, geckodriver version 0.21.0.

When I run the code, Firefox opens but doesn't launch the URL. Everything is up-to-date, geckodriver is set as marionette. Please help.

My code is:

package firstSelenium;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;


public class test {

    public static void main(String[] args) {

        System.setProperty(
                "webdriver.firefox.marionette", 
                "C:\\Users\\nargi\\Downloads\\geckodriver.exe"
        );

        WebDriver driver = new FirefoxDriver();
        driver.get("https://www.google.com");
    }
}

Solution

  • You must check the compatibility of your geckoDriver and your Mozilla Firefox driver. In my system I am using geckoDriver version as 0.21.0 and my MozillaFF browser is FireFox Quantam 64 bit version 61.0.1. In my system this code works fine.

    class Test{
    public static void main(String args[]){
    System.setProperty("webdriver.gecko.driver", path);
    WebDriver driver = new FirefoxDriver();
    driver.get("https://www.google.com");
    }
    

    }

    Please check the compatibility and let me know if it works. Also verify that path to geckoDriver is correct and there is no other .exe file named as geckodriver.exe