Priyanshu Shekhar Priyanshu Shekhar - 1 year ago 265
Java Question

How to use geckodriver in selenium webdriver 3.0 beta?

How can I use geckodriver for selenium webdriver 3.0 beta release. When I instantiate firefox like:

WebDriver driver = new FirefoxDriver();
System.setProperty("webdriver.gecko.driver", "//lib//geckodriver");

I get error:

Exception in thread "main" java.lang.IllegalStateException: The path
to the driver executable must be set by the webdriver.gecko.driver
system property; for more information, see

Answer Source

Got the solution:

System.setProperty("webdriver.gecko.driver", "pathTogeckodriver");
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("marionette", true);
WebDriver driver = new FirefoxDriver(capabilities);