Reputation: 293
Im new to Mac OSX. Downloaded my Robotframework(Selenium & Java) project from git and tried to execute the code locally wherein I received the below error.
Suite setup failed: IllegalStateException: The driver is not executable: /Users/roja/Documents/GitHub/testautomation/chromedrivers/chromedriver_osx
To rectify this issue, I followed the below but it didnt work.
- Upgraded the selenium-java and standalone version from 2.53.1 to 3.4.0.
- Driver path specified to Users/roja/automation
- Chromedriver upgraded from 2.31 to 2.33
- And the same driver version updated even in the path specified in the exception above.
Also Im unsure why the path is defaulted to /Users/roja/Documents/GitHub/testautomation/chromedrivers/chromedriver_osx
.
My git projects are saved in the path usr/local/git/testautomation and chromedriver also saved in the same. please clarify and provide me a solution.
Below code written for launching the browser,
public void LaunchBrowser() throws InterruptedException {
System.setProperty("Webdriver.chrome.driver", "/Users/roja/Automation/chromedriver_osx");
driver = new ChromeDriver();
driver.manage().window().maximize();
}
Upvotes: 8
Views: 22266
Reputation: 21
Run this command in the folder where chromedriver
is present: chmod +x chromedriver
Upvotes: 0
Reputation: 1
One More Solution :
Visit : https://sites.google.com/a/chromium.org/chromedriver/downloads enter image description here
Under "Current Releases" section, Click on Chrome driver link which is updated in your system.
Automatically it will redirect to "https://chromedriver.storage.googleapis.com/index.html?path=" enter image description here
Click on link for mac and unzip the folder.
Now paste chromedriver.exe file into your project.
And provide below mentioned code-
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class SetChromeDriver {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir") + "/chromedriver");
WebDriver driver = new ChromeDriver();
driver.get("https://www.google.com/");
driver.quit();
}
}
Upvotes: 0
Reputation: 11
Worked for me as well:
Step 1: Open terminal
Step 2: Navigate to the path folder containing chromedriver
Step 3: Run chmod +x chromedriver
Upvotes: 1
Reputation: 193078
To install the latest version of ChromeDriver:
Mac users with Homebrew:
brew tap homebrew/cask && brew cask install chromedriver
The error IllegalStateException: The driver is not executable: /Users/roja/Documents/GitHub/testautomation/chromedrivers/chromedriver_osx
says it all. You have to make exactly 4 changes as follows :
Change Webdriver.chrome.driver
as :
webdriver.chrome.driver
Change /Users/roja/Automation/chromedriver_osx
as we need to include the name of the webdriver binary
i.e. chromedriver
as a value
:
/Users/roja/Automation/chromedriver_osx/chromedriver
Change driver = new ChromeDriver();
as :
WebDriver driver = new ChromeDriver();
Remove unwanted throws InterruptedException
to keep your code short and simple.
Upvotes: 6
Reputation: 31
You may install chromedriver by brew
brew cask install chromedriver
After that, as DebanjanB said, replace your
System.setProperty("Webdriver.chrome.driver","/Users/roja/Automation/chromedriver_osx");
with
System.setProperty("webdriver.chrome.driver", "/usr/local/bin/chromedriver");
It works for me.
Upvotes: 0
Reputation: 596
For me, it was the last driver that was not working with the chrome version installed on my macOS mojave. I was forced to install last version of google chrome, then it worked.
Upvotes: 0
Reputation: 271
The way I solved this problem was by importing the chromedriver with right click>Import instead of dragging it to the folder.
I don't know exactly why, but it worked.
Upvotes: 0
Reputation: 1
It may be due to the permission access. Download the chrome driver using http://chromedriver.chromium.org/downloads and then give path.
Example:
System.setProperty("webdriver.chrome.driver","/Users/xyz/Downloads/chromedriver");
Upvotes: 0
Reputation: 66
I tried giving full permission to the chromedriver and it works fine.
chmod +x chromedriver
or
chmod 777 chromedriver
Upvotes: 5
Reputation: 305
FYI I had to do the solution proposed by varunrao321: Navigate to the folder containing chromedriver and run chmod +x chromedriver
Upvotes: 5
Reputation: 965
Another solution that worked for me. Navigate to the folder containing chromedriver and run "chmod +x chromedriver"
Upvotes: 2
Reputation: 4739
@debanjan already explain good expalaination to you, I am just giving you correct code:
public void LaunchBrowser() throws InterruptedException {
System.setProperty("webdriver.chrome.driver", "/Users/roja/Automation/chromedriver_osx/chromedriver");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
}
Upvotes: 0