0

I am trying to execute a basic test program with Selenium framework in Eclipse, but I am getting a java.lang.IllegalStateException error. I have added all the jar files and I am using Selenium 3.0.0 beta (Java).

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

public class test {

    public static void main(String[]args){

        WebDriver driver = new FirefoxDriver();
        driver.get("https://www.google.com");

    }
}

This is the error I am facing:

Exception in thread "main" java.lang.IllegalStateException: The driver executable does not exist: F:\JAVA\WebDriverTest1\<C Users MANOJ 6 Downloads gecko>
at com.google.common.base.Preconditions.checkState(Preconditions.java:199)
at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:121)
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:116)
at org.openqa.selenium.firefox.GeckoDriverService.access$100(GeckoDriverService.java:38)
at org.openqa.selenium.firefox.GeckoDriverService$Builder.findDefaultExecutable(GeckoDriverService.java:91)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:296)
at org.openqa.selenium.firefox.FirefoxDriver.createCommandExecutor(FirefoxDriver.java:244)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:219)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:214)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:210)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:123)
at Test1.Test.main(Test.java:11)
0buz
  • 3,443
  • 2
  • 8
  • 29
  • Possible duplicate of http://stackoverflow.com/questions/38751525/firefox-browser-is-not-opening-with-selenium-webbrowser-code – Michael Krause Sep 12 '16 at 20:26
  • Can you please add the full stack trace? All I can tell you with what you've posted is that some state, somewhere, is illegal. – Taylor Sep 12 '16 at 20:29
  • I have added gecko driver but it is not working either. System.setProperty("webdriver.gecko.driver", ""); – CuriosityKilledTheCat Sep 12 '16 at 21:03
  • Also i tried it converting into maven project by adding selenium dependencies but even that didn't worked – CuriosityKilledTheCat Sep 12 '16 at 21:10
  • @manojreddy instead of `System.setProperty("webdriver.gecko.driver", "");` Try: `System.setProperty("webdriver.gecko.driver", "C:\\\\Users\\MANOJ 6\\Downloads\\gecko");` – Cory Shay Sep 12 '16 at 21:10
  • @CoryShay thanks, i've tried that but it is still showing the same exception – CuriosityKilledTheCat Sep 12 '16 at 21:20
  • 1
    @manojreddy, Well it is attempting to find the file for your gecko driver and failing because the file doesn't exist. Therefore, if your driver is within your downloads file you will need to set it to the path of it including extension. For more information see this [answer](http://stackoverflow.com/a/38676858/6061947). – Cory Shay Sep 12 '16 at 21:22
  • Possible duplicate of [Fail to Launch Mozilla with selenium](http://stackoverflow.com/questions/38676719/fail-to-launch-mozilla-with-selenium) – Saurabh Gaur Sep 12 '16 at 23:19

0 Answers0