-1

I get an IllegalStateException while trying to run a basic test code with Selenium Webdriver.

This is my code written in eclipse :

{
...
System.setProperty("webdriver.ie.driver","<Absolutepath>/IEDriverServer.exe");

WebDriver driver=new InternetExplorerDriver(); //This is the line which throws the exception 
...
}

Exception trace:

java.lang.IllegalStateException: The driver executable does not exist.

at com.google.common.base.Preconditions.checkState(Preconditions.java:518)
    at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:123) 

The IEDriverServer.exe has been downloaded from SeleniumHQ downloads page and placed on my system(Windows 10).

The same exception is happening when I tried Chrome driver too.

I have gone through the similar posts but could not find something which solves the issue.

Elma
  • 1
  • 1
  • 2

1 Answers1

0

Have you added the absolute path to your PATH?

Windows>System>Advanced System Settings>Environment Variables

Under System variables edit Path and add the folder where you WebDriver.exe is

If you're looking for a nice cross browser plugin add the below dependency to your pom.xml and it will take care of everything for you:

<dependency>
            <groupId>io.github.bonigarcia</groupId>
            <artifactId>webdrivermanager</artifactId>
            <version>1.6.0</version>
            <exclusions>
                <exclusion>
                    <groupId>com.google.guava</groupId>
                    <artifactId>guava</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

then use:

 ChromeDriverManager.getInstance().setup();
 WebDriver driver = new ChromeDriver();

or

 InternetExplorerDriverManager.getInstance().setup();
 WebDriver driver = new InternetExplorerDriver();

Ive had quite a few issues running selenium webdriver in Windows 10 and IE11. If you don't have to i would switch to Chrome. Much easier.

Simon N
  • 337
  • 2
  • 13