rspec & rvm: unable to connect to chromedriver due to conflicting chromedrivers

After updating mac to Mojave, I ran into problems with Ruby 2.5.1 and had to reinstall it (I use rvm for that) and re-bundle my automation project.
It looks like rvm symlinks chromedriver to its own location:

$ which chromedriver

However, when I run my automation suite, I get:

Failure/Error: raise Error::WebDriverError, cannot_connect_error_text
unable to connect to chromedriver

and the browser doesn’t start.

I don’t know for sure, but after reading this thread on Github I figured that 2 chromedrivers (one in local and one in rvm) don’t work with each other very well.
Thanks to the thread above, I managed to fix this and since I had to use this solution at least twice now, I’m putting it here for future reference.

curl -o
mv chromedriver /usr/local/bin
chmod +x /usr/local/bin/chromedriver

Now, which chromedriver still returns the rvm location. To fix this, remove the chromedriver directory:

rm -rf /Users/anks/.rvm/gems/ruby-2.5.1/bin/chromedriver

and now which chromedriver is properly linked to local version:

$ which chromedriver

Written By anks

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.