Reputation: 253
I am getting this error:
Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see http://code.google.com/p/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html at com.google.common.base.Preconditions.checkState(Preconditions.java:197) at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:110) at org.openqa.selenium.chrome.ChromeDriverService.access$0(ChromeDriverService.java:1) at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:118) at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:291) at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:82) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:117) at selenium.basics.Chrome.chromeBrowser(Chrome.java:16) at selenium.basics.Firefox.main(Firefox.java:8)
Upvotes: 3
Views: 33171
Reputation: 164
1. You can check the current chromedriver version: chromedriver --version
2. Install via command line: https://formulae.brew.sh/cask/chromedriver
brew install --cask chromedriver
3. Be careful if your chrome version is not the same https://sites.google.com/chromium.org/driver/downloads
4. Add this driver to your selenium code
System.setProperty("webdriver.chrome.driver", "/usr/local/bin/chromedriver");
Upvotes: 2
Reputation: 112
Download the latest chrome version from
http://chromedriver.storage.googleapis.com/index.html
Path should be adjusted through build path.
Try it once, it is helping to you...
Upvotes: 2
Reputation: 630
Spent a few good hours trying to get Selenium/Chrome to work on my Mac.
The obvious:
What I was missing:
Hope this helps
Upvotes: 0
Reputation: 1053
You can use brew to install chromedriver and keep it up-to-date:
brew install chromedriver
Upvotes: 2
Reputation: 1
Extract the chrome/firefox driver executable to Applications folder and follow the below code.
This should work for you :
System.setProperty("webdriver.chrome.driver", "/Applications/chromedriver");
WebDriver driver = new ChromeDriver();
Upvotes: 0
Reputation: 113
user5899853 Try this:
System.setProperty("webdriver.chrome.driver" , "/Users/sampada/Applications/chromedriver");
And:
@BeforeClass
public static void init() {
driver = new ChromeDriver(); //init chrome driver
driver.get("http://google.com”); //url of website we like to test
Upvotes: 4