January 11, 2018

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

  unable to connect to chromedriver         

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

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,
written by Dwight Watson.