Shani
Shani

Reputation: 27

Error occurred when use gecko in selenium

i am new to selenium automation and i have follwed the instruction of the web site and i have use gecko driver but it shows message as below.i have follow few web articals but i didnt get the solution.i am using firefox 60.0.2 (64-bit) , Selenium 3.12 and gecko driver 20.1 .

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 https://github.com/mozilla/geckodriver. The latest version can be downloaded from https://github.com/mozilla/geckodriver/releases
    at com.google.common.base.Preconditions.checkState(Preconditions.java:847)

here is my code

package automationFramework;

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

public class userLogin{

public static void main(String[] args){

    System.setProperty("webdriver.gecko.driver ","E:\\\\Selenium\\\\geckodriver-v0.21.0-win64\\\\geckodriver.exe");
    WebDriver driver = new FirefoxDriver();
    driver.get("https://www.facebook.com/");
}

Edit: reformat code

Upvotes: 2

Views: 176

Answers (1)

Ranjith's
Ranjith's

Reputation: 4730

Replace it

System.setProperty("webdriver.gecko.driver","E:\\\\Selenium\\\\geckodriver-v0.21.0-win64\\\\geckodriver.exe");

it has extra space...

Upvotes: 2

Related Questions