Error when runs the code

Hi, im new to selenium and i have rite the first code in java and when i run is is shows ‘The path to the driver executable must be set by webdriver.gecko.driver system property: ” erorr and i have followed your steps to resolve it.but still, im having errors.please help me to solve this.below attached the erro that i have after followed your steps.


Java version is 9 , Selenium version is 3.8.1 and the firefox version is 57



This is my code ========================================= package test; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.remote.DesiredCapabilities; public class loginNavigation { public static void main(String[] args) throws InterruptedException { DesiredCapabilities capabilities = DesiredCapabilities.firefox(); capabilities.setCapability(“marionette”, true); WebDriver driver = new FirefoxDriver(capabilities); driver.get(“”); Thread.sleep(5000); driver.quit(); } } ====================================================== =============== this is the error ===== selenium.remote.DesiredCapabilities firefox INFO: Using new FirefoxOptions() is preferred to DesiredCapabilities.firefox() 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 The latest version can be downloaded from at at org.openqa.selenium.remote.service.DriverService.findExecutable( at org.openqa.selenium.firefox.GeckoDriverService.access$100( at org.openqa.selenium.firefox.GeckoDriverService$Builder.findDefaultExecutable( at org.openqa.selenium.remote.service.DriverService$ at org.openqa.selenium.firefox.FirefoxDriver.toExecutor( at org.openqa.selenium.firefox.FirefoxDriver.<init>( at org.openqa.selenium.firefox.FirefoxDriver.<init>( at test.loginNavigation.main(

Default Asked on January 4, 2018 in Selenium WebDriver.
Add Comment
  • 1 Answer(s)

    download geckodriver.exe….and set the path


    System.setProperty(“webdriver.gecko.driver”, “path of the geckodriver.exe”);


    it might be  solve your issue

    Default Answered on January 6, 2018.

    Do i set the path in environmental variable ?? Once i did and compile the code again it shows error as  below  


    this is my path – E:\Selenium\geckodriver-v0.19.1-win64


    Exception in thread “main” java.lang.Error: Unresolved compilation problems: Exception in thread “main” java.lang.Error: Unresolved compilation problems:  Syntax error on token “Invalid Character”, delete this token Syntax error on tokens, delete these tokens Syntax error on token “.19”, -> expected Syntax error on token “Invalid Character”, ElidedSemicolonAndRightBrace expected at test.loginNavigation.main(  

    on January 9, 2018.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.