Govind Rudrawar
Govind Rudrawar

Reputation: 23

I am not able to launch the browser by using Selenium

My Code :

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;

public class FirstAutomation {

    public static void main(String[] args) {
        System.setProperty("webdriver.chrome.driver", "C:\\Users\\sony\\Downloads\\chromedriver_win32.exe");
        WebDriver driver = new ChromeDriver();
        driver.get("https://wwww.google.com");
      }
}

Exceptions

Exception in thread "main" java.lang.IllegalStateException: The driver executable does not exist: C:\Users\sony\Downloads\chromedriver_win32.exe at com.google.common.base.Preconditions.checkState(Preconditions.java:534) at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:136) at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:131) 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.(ChromeDriver.java:123) at FirstAutomation.main(FirstAutomation.java:8)

Upvotes: 1

Views: 1698

Answers (2)

VIKAS DADI
VIKAS DADI

Reputation: 36

Please follow the below steps to add the Chromedriver.exe

Right Click on your Selenium Project -> Build Path -> Configure Build Path -> Libraries -> Add External Class Folder

Note: kindly cross-check the chrome driver Path location in your pc and make sure the chrome driver version and google chrome version's match each other

Link to download the latest Chrome Driver

I hope the above process Works

Upvotes: 2

Govind Rudrawar
Govind Rudrawar

Reputation: 23

Thanks to Vikas Dadi. I had downloaded chrome driver of 80 version and the actual browser being used on the laptop was 79, hence the error. But now it is working fine after deleting the driver and reinstalling the driver of the same version.

Upvotes: 1

Related Questions