Colin Cook Colin Cook - 10 days ago 5
Java Question

Selenium Chrome driver wont open

Cannot figure out how to get Chromedriver to launch. Made sure i have the latest chromedriver.exe but still cannot get the driver to launch. Any ideas?

This is what I'm getting

"C:\Program Files (x86)\Java\jdk1.8.0_101\bin\java" -Didea.launcher.port=7535 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files (x86)\Java\jdk1.8.0_101\jre\lib\charsets.jar;C:\Program Files (x86)\Java\jdk1.8.0_101\jre\lib\deploy.jar;C:\Program Files (x86)\Java\jdk1.8.0_101\jre\lib\ext\access-bridge-32.jar;C:\Program Files (x86)\Java\jdk1.8.0_101\jre\lib\ext\cldrdata.jar;C:\Program Files (x86)\Java\jdk1.8.0_101\jre\lib\ext\dnsns.jar;C:\Program Files (x86)\Java\jdk1.8.0_101\jre\lib\ext\jaccess.jar;C:\Program Files (x86)\Java\jdk1.8.0_101\jre\lib\ext\jfxrt.jar;C:\Program Files (x86)\Java\jdk1.8.0_101\jre\lib\ext\localedata.jar;C:\Program Files (x86)\Java\jdk1.8.0_101\jre\lib\ext\nashorn.jar;C:\Program Files (x86)\Java\jdk1.8.0_101\jre\lib\ext\sunec.jar;C:\Program Files (x86)\Java\jdk1.8.0_101\jre\lib\ext\sunjce_provider.jar;C:\Program Files (x86)\Java\jdk1.8.0_101\jre\lib\ext\sunmscapi.jar;C:\Program Files (x86)\Java\jdk1.8.0_101\jre\lib\ext\sunpkcs11.jar;C:\Program Files (x86)\Java\jdk1.8.0_101\jre\lib\ext\zipfs.jar;C:\Program Files (x86)\Java\jdk1.8.0_101\jre\lib\javaws.jar;C:\Program Files (x86)\Java\jdk1.8.0_101\jre\lib\jce.jar;C:\Program Files (x86)\Java\jdk1.8.0_101\jre\lib\jfr.jar;C:\Program Files (x86)\Java\jdk1.8.0_101\jre\lib\jfxswt.jar;C:\Program Files (x86)\Java\jdk1.8.0_101\jre\lib\jsse.jar;C:\Program Files (x86)\Java\jdk1.8.0_101\jre\lib\management-agent.jar;C:\Program Files (x86)\Java\jdk1.8.0_101\jre\lib\plugin.jar;C:\Program Files (x86)\Java\jdk1.8.0_101\jre\lib\resources.jar;C:\Program Files (x86)\Java\jdk1.8.0_101\jre\lib\rt.jar;C:\Users\Colin Cook\mt\Selenium\target\classes;C:\Users\Colin Cook\Desktop\selenium-2.53.1\libs\apache-mime4j-0.6.jar;C:\Users\Colin Cook\Desktop\selenium-2.53.1\libs\bsh-2.0b4.jar;C:\Users\Colin Cook\Desktop\selenium-2.53.1\libs\cglib-nodep-2.1_3.jar;C:\Users\Colin Cook\Desktop\selenium-2.53.1\libs\commons-codec-1.10.jar;C:\Users\Colin Cook\Desktop\selenium-2.53.1\libs\commons-exec-1.3.jar;C:\Users\Colin Cook\Desktop\selenium-2.53.1\libs\commons-io-2.4.jar;C:\Users\Colin Cook\Desktop\selenium-2.53.1\libs\commons-logging-1.2.jar;C:\Users\Colin Cook\Desktop\selenium-2.53.1\libs\gson-2.3.1.jar;C:\Users\Colin Cook\Desktop\selenium-2.53.1\libs\guava-19.0.jar;C:\Users\Colin Cook\Desktop\selenium-2.53.1\libs\hamcrest-core-1.3.jar;C:\Users\Colin Cook\Desktop\selenium-2.53.1\libs\hamcrest-library-1.3.jar;C:\Users\Colin Cook\Desktop\selenium-2.53.1\libs\httpclient-4.5.1.jar;C:\Users\Colin Cook\Desktop\selenium-2.53.1\libs\httpcore-4.4.3.jar;C:\Users\Colin Cook\Desktop\selenium-2.53.1\libs\httpmime-4.5.jar;C:\Users\Colin Cook\Desktop\selenium-2.53.1\libs\jcommander-1.48.jar;C:\Users\Colin Cook\Desktop\selenium-2.53.1\libs\jna-4.1.0.jar;C:\Users\Colin Cook\Desktop\selenium-2.53.1\libs\jna-platform-4.1.0.jar;C:\Users\Colin Cook\Desktop\selenium-2.53.1\libs\junit-4.12.jar;C:\Users\Colin Cook\Desktop\selenium-2.53.1\libs\netty-3.5.7.Final.jar;C:\Users\Colin Cook\Desktop\selenium-2.53.1\libs\phantomjsdriver-1.2.1.jar;C:\Users\Colin Cook\Desktop\selenium-2.53.1\libs\testng-6.9.9.jar;C:\Users\Colin Cook\Desktop\selenium-java-3.0.1\client-combined-3.0.1-nodeps.jar;C:\Users\Colin Cook\.m2\repository\org\apache\commons\commons-lang3\3.0\commons-lang3-3.0.jar;C:\Users\Colin Cook\Desktop\selenium-2.53.1\selenium-server-standalone-2.53.1.jar;C:\Users\Colin Cook\Desktop\selenium-2.53.1\selenium-java-2.53.1.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.3\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain com.colin.cook.Chromedriver
Exception in thread "main" java.lang.IllegalStateException: The driver executable is a directory: C:\Users\Colin Cook\Desktop\selenium-2.53.1
at com.google.common.base.Preconditions.checkState(Preconditions.java:199)
at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:123)
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:116)
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:296)
at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:88)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:120)
at com.colin.cook.Chromedriver.main(Chromedriver.java:16)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)


Heres my Code

public class Chromedriver {

/*
@param args
*/
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "C:\\Users\\Colin Cook\\Desktop\\selenium-2.53.1");
WebDriver driver = new ChromeDriver();
driver.get("http://google.com");



}

}

Answer

Add .exe to your driver executable. Should be like

System.setProperty("webdriver.chrome.driver", "C:\\Users\\Colin Cook\\Desktop\\selenium-2.53.1.exe");