Mac OSX - IllegalStateException: The driver is not executable:

Roja picture Roja · Nov 15, 2017 · Viewed 10.6k times · Source

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.

  1. Upgraded the selenium-java and standalone version from 2.53.1 to 3.4.0.
  2. Driver path specified to Users/roja/automation
  3. Chromedriver upgraded from 2.31 to 2.33
  4. 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();
}

Answer

DebanjanB picture DebanjanB · Nov 15, 2017

Quick installation of the latest ChromeDriver

To install the latest version of ChromeDriver:

  • Mac users with Homebrew:

    brew tap homebrew/cask && brew cask install chromedriver
    

Original answered Nov 15 '17 at 12:04

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.