0
votes

I have downloaded selenium 3 jars and also have installed chrome driver. The following is the code - package samplewebchrome;

import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver;

public class googlewindows {

public static void main(String[] args) {

    String baseUrl = "http;//www.goggle.com";

    WebDriver driver;

    System.setProperty("webdriver.chrome.driver","C:\\Users\\Admin\\eclipse-workspace\\Selenium3\\bin\\samplewebchrome\\chromedriver.exe");

    driver = new ChromeDriver();
    driver.get(baseUrl);
    driver.navigate().back();
}

}

and the error message is as follows: Exception in thread "main" java.lang.IllegalStateException: The driver executable does not exist: C:\Users\Admin\Downloads\Selenium important files\chromedriver at com.google.common.base.Preconditions.checkState(Preconditions.java:585) at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:137) at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:132) at org.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDriverService.java:35) at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:156) at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:346) at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:91) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:123) at samplewebchrome.googlewindows.main(googlewindows.java:18)

I am struggling with this issue from today morning. It would be of great help if someone tries to give me a solution over this issue. Thanks in advance.

2
Can you check whether the chrome driver is available in the specified location? - Subburaj
Can you share the exact version of chrome browser , chrome driver , selenium version , and your OS ? - cruisepandey
In addition to setting the correct location to the executable, add the line ChromeOptions options = new ChromeOptions(); followed by driver = new ChromeDriver(options). - Bill Hileman
@cruisepandey - chrome browser = Version 68.0.3440.75 (Official Build) (64-bit), chrome driver = ChromeDriver 2.40.565498 , selenium version = 3.13.0 and OS =Windows 10 64 bit - ameya garge
Your sample code says C:\\Users\\Admin\\eclipse-workspace\\Selenium3\\bin\\samplewebchrome\\chromedriver.exe but the error says C:\Users\Admin\Downloads\Selenium important files\chromedriver. These do not match! Could you post minimal reproducible example how exactly you are running this? - SiKing

2 Answers

0
votes

To verify chrome driver is compatible with your current chrome & selenium version, do the following:

Keep downloaded chrome driver at System32 if you are on Windows OS & /usr/local/bin if you are on Mac OSX

  1. Run the Selenium Standalone server by this command: java -jar selenium-server-standalone-3.13.0.jar
  2. Open this url in chrome browser: http://localhost:4444/wd/hub
  3. Create Session and Select Chrome browser

If browser starts then there is no issue with the compatibility of chrome driver with Chrome & Selenium version.

0
votes

put chromedriver.exe at
C:\\Users\\Admin\\eclipse-workspace\\Selenium3\\bin\\samplewebchrome\\
as you are setting property as

 System.setProperty("webdriver.chrome.driver","C:\\Users\\Admin\\eclipse-workspace\\Selenium3\\bin\\samplewebchrome\\chromedriver.exe");

Also make sure your chrome browser version and chromedriver are compatible,if you are using latest chrome browser then the latest chromedriver.exe can be downloaded from http://chromedriver.storage.googleapis.com/index.html