1

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");
    }
}
Pang
  • 9,564
  • 146
  • 81
  • 122
Narcissa
  • 21
  • 1
  • 3
  • As answered by amsankalp89 please update Property to gecko driver and code will work – thebadguy Sep 13 '18 at 05:00
  • Possible duplicate of [How to start FireFoxDriver using Selenium 3.4.0 using Maven?](https://stackoverflow.com/questions/43757984/how-to-start-firefoxdriver-using-selenium-3-4-0-using-maven) – JeffC Sep 13 '18 at 14:47

3 Answers3

2

Use correct setProperty, as you are using gecko driver, so you need to use "webdriver.gecko.driver"

Correct code is

public class test {
public static void main(String[] args) {
System.setProperty("webdriver.gecko.driver","C:\\Users\\nargi\\Downloads\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get("https://www.google.com");
}
}
iamsankalp89
  • 4,607
  • 2
  • 15
  • 36
  • I think it should work for you Please check it once. it helps you please accept or any help needed let me know – iamsankalp89 Sep 13 '18 at 09:16
  • I have tried this way, but i keep getting an error message Exception in thread "main" java.lang.IllegalStateException: The driver executable does not exist: C:\Users\nargi\Downloads\geckodriver.exe – Narcissa Sep 14 '18 at 04:22
  • I will check as my side there is no issue, try with updated selenium jars – iamsankalp89 Sep 14 '18 at 04:47
1

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

  • Hi, my geckodriver version is 0.21.0 and firefox quantum version 63.o beta version. it looks like i wrote the path wrong to the geckodriver. It worked!! Thanks a lot! – Narcissa Sep 15 '18 at 03:45
  • So, in that case, my answer is also correct:) Anyway @Mukul Maheshwari there is no difference in my and your answer. +1 – iamsankalp89 Sep 17 '18 at 04:11
  • Yes @iamsankalp89 as Narcissa said, the geckodriver path was incorrect in code, there was no other code issue. – Mukul Maheshwari Sep 17 '18 at 06:52
0

For me this issue was solved when "marionette" was changed to "gecko.driver"