1

After running this code the Chrome browser does not lunch.

I'm using Chrome browser v.71.0.3578.98 (official build), (32 bit) and the chrome driver version 2.42

public class MainClass {

    public static void main (String [] args ) {
        System.setProperty("webdriver.chrome.driver",
                            "C:\\Users\\Lenovo\\IdeaProjects\\Testnext\\Driver");    
        WebDriver driver = new ChromeDriver();    
        driver.get("https:facebook.com");
    }
}

This is the actual result:

Exception in thread "main" java.lang.IllegalStateException: The driver executable is a directory: C:\Users\Lenovo\IdeaProjects\Testnext\Driver
at com.google.common.base.Preconditions.checkState(Preconditions.java:585)
at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:148)
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:141)
at org.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDriverService.java:35)
at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:159)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:355)
at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:94)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:123)
at MainClass.main(MainClass.java:10)

Process finished with exit code 1

Karol Dowbecki
  • 43,645
  • 9
  • 78
  • 111
sero
  • 45
  • 3

1 Answers1

2

webdriver.chrome.driver property must point to the chromedriver.exe executable, not to a directory containing it.

Locate the chromedriver.exe executable on your file system and correct your property value.

Karol Dowbecki
  • 43,645
  • 9
  • 78
  • 111