Reputation: 41
I am using the following code to run chrome driver:
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.ChromeDriver;
public class TestClass
{
public static void main(String[] args){
System.setProperty("webdriver.chrome.driver", "/Users/raisa/Documents/Selenium/chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("http://www.google.com");
driver.quit();
}
}
But I am getting this error:
Exception in thread "main" java.lang.IllegalStateException: The driver executable does not exist: /Users/raisa/Documents/Selenium/chromedriver.exe
at com.google.common.base.Preconditions.checkState(Preconditions.java:177)
at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:117)
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:112)
at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:89)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:117)
at TestClass.main(TestClass.java:11)
I have downloaded the latest chrome driver from http://chromedriver.storage.googleapis.com/index.html
Upvotes: 4
Views: 8408
Reputation: 314
Through terminal navigate to the place where chromedriver is located and then execute following command.
xattr -d com.apple.quarantine chromedriver
Upvotes: 0
Reputation: 517
I agree with the comments.
On Mac OS you will not need .exe
after chromedriver
.
For your example you'll want it to look like this: /Users/raisa/Documents/Selenium/chromedriver
.
I've also seen this problem come up because the execute permissions wasn't set for the file. So double check the file permissions, and also that the file is in the actual path given.
Upvotes: 4