So I have read all the docs on adding chromedriver to my path and followed all of them. I am on a Mac with selenium2, maven, eclipse, and all the latest drivers:
<
Try this:
System.setProperty("webdriver.chrome.driver","/location to/chromedriver folder");
WebDriver driver = new ChromeDriver();
driver.get("your.app");
It works for me without setting webdriver.chrome.driver property. Just by adding chromedriver to PATH
> echo $PATH
/usr/local/bin:/usr/local/sbin:~/bin:/usr/bin:/bin:/usr/sbin:/sbin
>
> which chromedriver
/usr/local/bin/chromedriver
If you use Homebrew, installing chromedriver along with adding to PATH can be done as simple as this:
brew install chromedriver
Useful links:
https://sites.google.com/a/chromium.org/chromedriver/
http://brewformulas.org/Chromedriver
Just add WebDriverManager in your maven pom and it works without manual setup if you have your browser setup in default config.
Add this dependency to your project:
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>4.2.2</version>
</dependency>
This library downloads the latest version of the WebDriver binary you need and export the proper Java system variable (webdriver.chrome.driver, webdriver.gecko.driver, webdriver.opera.driver, phantomjs.binary.path, webdriver.edge.driver, webdriver.ie.driver), simply using one of the following sentences respectively:
WebDriverManager.chromedriver().setup();
WebDriverManager.firefoxdriver().setup();
WebDriverManager.operadriver().setup();
WebDriverManager.phantomjs().setup();
WebDriverManager.edgedriver().setup();
WebDriverManager.iedriver().setup();
More info on https://github.com/bonigarcia/webdrivermanager