Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to find the chromedriver executable. Ruby. Webdriver. Mac

Please help!

I am trying to run my testing script using Ruby and Selenium Web driver.

require "selenium-webdriver"

driver = Selenium::WebDriver.for :chrome
driver.navigate.to "google.com"
driver.quit

but it gives me an error

 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 https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. (Selenium::WebDriver::Error::WebDriverError)

I have installed the chromedriver and unzipped it in the directory ~/webdrivers. And added the path to the chromedriver to the PATH. Then I tried to move the chromedriver to ~/bin directory and have it in PATH.

Nothing worked. I still get the error.

Thank you.

like image 686
user3907934 Avatar asked Oct 26 '25 06:10

user3907934


1 Answers

1 - Download the ChromeDriver executable.

2 - Either create your own PATH to a unique folder on your mac or copy the file to an existing PATH directory. To do this:

  a - Open up Terminal
  b - Run sudo nano /etc/paths
  c - Enter your password
  d - Go to the bottom of the file and enter the path you wish to add
  e - My PATH looks like: /Users//Documents/WebDriver
  f - Control-x to quit
  g - Y to save

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.

Finally, update your tests to run using ChromeDriver (include code snippet) and run your tests!


Another tip: if you use brew on Mac I would recommend brew install chromedriver.

re-run "selenium-standalone install" after re-installing

like image 188
Juan Castelli Avatar answered Oct 27 '25 23:10

Juan Castelli



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!