flavorjones/chromedriver-helper

Using with Rails: "uninitialized constant Selenium"

mattbrictson opened this issue · 5 comments

I just upgraded an existing Rails app to chromedriver-helper 2.0, and upon running my app I get this error:

bundler-1.16.4/lib/bundler/runtime.rb:84:in `rescue in block (2 levels) in require':
There was an error while trying to load the gem 'chromedriver-helper'.
Gem Load Error is: uninitialized constant Selenium
Backtrace for gem load error is:
chromedriver-helper-2.0.0/lib/chromedriver-helper.rb:1:in `<top (required)>'

Workaround: place the chromedriver-helper gem after selenium in app's Gemfile. E.g.

group :test do
  gem "selenium-webdriver"
  gem "chromedriver-helper" # must load after selenium
end

Another possible workaround (it doesn't hurt rubocop's gem order rule) is to require manually in <rails/spec/capybara>_helper

require 'selenium/webdriver'
require 'chromedriver-helper'

and require: false in gemfile

gem 'chromedriver-helper', require: false
gem 'selenium-webdriver', require: false

Seems easy to fix, let me repro and cut a patch release.

Release v2.0.1 which fixes this. Thanks for reporting!!

Should selenium-webdriver not be in the gemspec now it's explicitly required?

@markedmondson Please see comments in #61 about this; it's possible to run chromedriver-helper as a standalone gem that doesn't need selenium-webdriver.