Since last update of selenium 3, Most of the users(especially those who are new with selenium) are facing common issue with 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 https://github.com/mozilla/geckodriver. The latest version can be downloaded from https://github.com/mozilla/geckodriver/releases" when try to execute test in firefox browser.
Configure Geckodriver In Selenium Test
This error is bout downloading latest version of geckodriver exe and configuring it with your selenium test. So, Lets see how to do it.
To resolve this issue,
- You have to download latest version of geckodriver from HERE.
- Download wi32 or win64 zip file as per your system configuration.
- Now extract the zip file.
- You will get geckodriver.exe from extracted folder.
- Now Put geckodriver.exe in you E: drive.
- Now you have to provide path of geckodriver.exe in your selenium test using System.setProperty as given in below given test.
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class test {
public static void main(String[] args) {
//Set the path of geckodriver.exe.
System.setProperty("webdriver.gecko.driver","E:\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
driver.get("http://www.google.com");
driver.quit();
}
}
That is it. Your test will run smoothly now in firefox browser.
No comments:
Post a Comment