8

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();
}
Prags
  • 2,457
  • 2
  • 21
  • 38
Roja
  • 293
  • 1
  • 5
  • 21

12 Answers12

6

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.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
5

FYI I had to do the solution proposed by varunrao321: Navigate to the folder containing chromedriver and run chmod +x chromedriver

Jorge
  • 182
  • 1
  • 4
  • 12
5

I tried giving full permission to the chromedriver and it works fine.

chmod +x chromedriver

or

chmod 777 chromedriver
DJo
  • 2,133
  • 4
  • 30
  • 46
anandxp
  • 66
  • 1
  • 2
2

Another solution that worked for me. Navigate to the folder containing chromedriver and run "chmod +x chromedriver"

varunrao321
  • 925
  • 2
  • 10
  • 18
1

Worked for me as well:

Step 1: Open terminal
Step 2: Navigate to the path folder containing chromedriver
Step 3: Run chmod +x chromedriver

0

@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();
}
iamsankalp89
  • 4,607
  • 2
  • 15
  • 36
0

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");       
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
0

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.

double-beep
  • 5,031
  • 17
  • 33
  • 41
NilVS
  • 181
  • 1
  • 2
  • 9
0

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.

Luisa Hernández
  • 596
  • 1
  • 3
  • 17
0

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.

E Kwong
  • 11
  • 5
0

One More Solution :

  1. Visit : https://sites.google.com/a/chromium.org/chromedriver/downloads enter image description here

  2. Under "Current Releases" section, Click on Chrome driver link which is updated in your system.

  3. Automatically it will redirect to "https://chromedriver.storage.googleapis.com/index.html?path=" enter image description here

  4. Click on link for mac and unzip the folder.

  5. Now paste chromedriver.exe file into your project.

  6. 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();
    
        }
    
    }
    
    
SHR
  • 7,940
  • 9
  • 38
  • 57
0

Run this command in the folder where chromedriver is present: chmod +x chromedriver

Franco
  • 669
  • 2
  • 8
  • 23
varun raj
  • 21
  • 2