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(); } 

    12 Answers 12

    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.

    3
    • 1
      Thanks a lot @DebanjanB . Followed the 1st change and it worked. Such a silly i did. Thanks a lot again.
      – Roja
      CommentedNov 15, 2017 at 12:31
    • 1
      Nice expalination @DebanjanB +1CommentedNov 15, 2017 at 12:39
    • For all those who are struggling with 'cask' not found, use brew install --cask chromedriverCommentedSep 13, 2021 at 17:28
    5

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

      5

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

      chmod +x chromedriver 

      or

      chmod 777 chromedriver 
        2

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

          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(); } 
              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"); 
                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.

                  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.

                    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.

                      0

                      One More Solution :

                      1. Visit : https://sites.google.com/a/chromium.org/chromedriver/downloadsenter 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(); } } 
                        0

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

                          Start asking to get answers

                          Find the answer to your question by asking.

                          Ask question

                          Explore related questions

                          See similar questions with these tags.