Read more

chromedriver-helper gem in Gemfile might break you selenium tests (of other projects)

Emanuel
October 26, 2017Software engineer at makandra GmbH

Summary: Don't add chromedriver-helper to the Gemfile

  • the executables might break your tests in projects where chromedriver-helper is not in the Gemfile
  • developers with different chrome versions will have problems using the same chromedriver-helper version

Background

If you install the chromedriver-helper gem, but don't have it in you Gemfile, your selenium tests might fail with:

Selenium::WebDriver::Error::WebDriverError: unable to connect to chromedriver 127.0.0.1:9515
Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

The reason is that chromedriver-helper overrides the chromedriver path of your system:

which chromedriver
/home/username/.rvm/gems/ruby-2.4.1/bin/chromedriver
# instead of e.g. /home/username/bin/chromedriver

Setting WebDriver.logger.level = :debug will tell you then the reason why selenium-webdriver fails:

can't find executable chromedriver for gem chromedriver-helper. chromedriver-helper is not currently included in the bundle, perhaps you meant to add it to your Gemfile? (Gem::Exception)

chromedriver-helper overrides rbenv path

If chromedriver points to a specific rbenv ruby version,

which chromedriver
/home/username/.rbenv/versions/2.4.1/bin/chromedriver
# instead of e.g. /home/username/bin/chromedriver

uninstall chromedriver-helper gem and execute rbenv rehash.

Posted by Emanuel to makandra dev (2017-10-26 17:53)