Dwight Watson's blog

Selenium::WebDriver::Error::WebDriverError

This blog post was originally published a little while ago. Please consider that it may no longer be relevant or even accurate.

Occasionally I run into an issue where my RSpec system tests start to fail because they're unable to connect to the chromedriver instance.

Selenium::WebDriver::Error::WebDriverError:
unable to connect to chromedriver 127.0.0.1:9516

It turns out that somehow a gem called chromedriver-helper ends up getting installed from something else, and it has it's own executable called chromedriver which RSpec ends up calling instead of the actual chromedriver. You can verify this is the case by checking which executable is being called - I have my chromedriver installed by Homebrew.

$ which chromedriver
/usr/local/bin/chromedriver

If the result for you references a gem instead, then you'll need to uninstall it.

$ gem uninstall chromedriver-helper

This normally does the trick for me, but you might also need to get rbenv to rebuild it's links which only takes a second.

$ rbenv rehash

Now check the location of your chromedriver and you should be good to go.

A blog about Laravel & Rails by Dwight Watson;

Picture of Dwight Watson

Follow me on Twitter, or GitHub.