java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property

0
0

Here is my code:

package Basics;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class invokegoogle {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("Webdriver.chrome.driver", "C:\\Users\\sravani\\Desktop.exe");
WebDriver driver=new ChromeDriver();
driver
.get("http://qaclickacademy.com");
}
}

Getting the following errors:

Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html
at com
.google.common.base.Preconditions.checkState(Preconditions.java:754)
at org
.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:124)
at org
.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDriverService.java:32)
at org
.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:137)
at org
.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:329)
at org
.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:88)
at org
.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:124)
at
Basics.invokegoogle.main(invokegoogle.java:12)

Any help is highly appreciated. Thanks in advance

  • You must to post comments
0
0

Assuming the chromedriver.exe is stored at your desktop, you need to make a couple of changes as follows:

Change:

System.setProperty("Webdriver.chrome.driver", "C:\\Users\\sravani\\Desktop.exe");

To:

System.setProperty("webdriver.chrome.driver", "C:\\Users\\sravani\\Desktop\\chromedriver.exe");
  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Website