Installing ChromeDriver on Mac OSX


Google_ChromeThe ChromeDriver Getting started guide wasn’t super helpful with it’s installation instructions, mainly because I was unfamiliar with including the ChromeDriver location in my PATH environment variable. Don’t get me wrong, I’ve updated PATH variables on Windows for years but never on a Mac. In my search for more helpful instructions I came up with a more helpful and longer install guide for ChromeDriver.

First we’ll need to download the ChromeDriver executable. Once we have it, we’ll need to tell Selenium where it is and for that we have a few choices (1 & 2).

  1. Specify it in the Selenium Setup or
  2. Add it to the System PATH.
    1. These instructions will help you create your own PATH to a unique folder on your Mac or copy the file to an existing PATH directory.
    2. To do this:
      1. Open up Terminal
      2. Run sudo nano /etc/paths
      3. Enter your password
      4. Go to the bottom of the file and enter the path you wish to add
      5. My PATH looks like: /Users/name/Documents/WebDriver
      6. Control-x to quit
      7. Y to save
      8. Press enter to confirm
    3. To double check, quit Terminal and relaunch it. Run echo $PATH. You should see your newly added path in the stream of other paths already there.
  3. Finally, update your tests to run using ChromeDriver and run your tests!

After running your tests, if your PATH isn’t set up correctly you get this helpful message:

Selenium::WebDriver::Error::WebDriverError: Unable to find the chromedriver executable. Please download the server from http://chromedriver.storage.googleapis.com/index.html and place it somewhere on your PATH. More info at http://code.google.com/p/selenium/wiki/ChromeDriver.

Next up? Installing the SafariDriver, which is far and away a simpler process.

Additional References:

  • Robin Linus

    Thanks for your instructions!
    There is a little typo… you meant:
    sudo nano /etc/paths

  • Everett Griffiths

    Hmmm…. incomplete…. not sure why the selenium-standalone is looking for the executable in the wrong place:

    ERROR: The driver executable does not exist: /usr/local/lib/node_modules/selenium-standalone/.selenium/chromedriver/2.20-x64-chromedriver

    browserName: “chrome”

    • Check to make sure your PATH is set up / pointed correctly!

      • Everett Griffiths

        The problem was that I hadn’t re-run “selenium-standalone install” after re-installing. It’s easy to forget because basic stuff works, but some drivers don’t get installed.

  • rubytester

    if you use brew on Mac I would recommend `brew install chromedriver`

    • ataraxio

      Thanks @rubytester:disqus, `brew install chromedriver` works for me 🙂

  • Thankyou

    Thanks man this was really good article! 🙂 You are right, ChromeDriver’s instructions sucked