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

842 views
Skip to first unread message

Robert

unread,
Oct 8, 2011, 12:53:14 PM10/8/11
to webd...@googlegroups.com
I'm attempting to use the Chrome driver.  However, each time I try to start the driver with the code listed below, I get an IllegalStateException: The path to the chromedriver executable must be set by the webdriver.chrome.driver system property

What am I missing?


private WebDriver loadChromeDriver() throws MalformedURLException {
System.setProperty("webdriver.chrome.driver", "./src/test/resources/chromedriver");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
return new RemoteWebDriver(new URL("http://localhost:5555/wd/hub"), capabilities);
}

Krishnan Mahadevan

unread,
Oct 9, 2011, 10:33:58 PM10/9/11
to webd...@googlegroups.com
Robert,

My guess is, that the statement "System.setProperty("webdriver.chrome.driver", "./src/test/resources/chromedriver");"
is probably not helping the webdriver resolve to an absolute path on your file system, from where the chromedriver could be fetched.
You could probably try this instead :

String path = this.getClass().getClassLoader().getResource("chromedriver.exe").getPath();
System.setProperty("webdriver.chrome.driver",path);

Hopefully that should work.


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/8u9uVz5ZZFEJ.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.

Reply all
Reply to author
Forward
0 new messages