LoadError on project which does not use selenium-webdriver #1018

Closed
mhoran opened this Issue Mar 18, 2013 · 12 comments

Projects

None yet

4 participants

@mhoran
mhoran commented Mar 18, 2013

As a result of #970, selenium-webdriver is now an optional dependency of Capyabra. However, on projects where selenium-webdriver is not in the Gemfile, a LoadError is raised even if selenium-webdriver is not used. This is due to the uncondional require of capybara/selenium/driver on line 321 of capybara.rb: http://git.io/0tRUfQ.

@topfunky

I am also experiencing this after upgrading to 2.1.0.beta1.

@jnicklas jnicklas closed this in 07f2a71 Mar 18, 2013
@jnicklas
Collaborator

I messed up when I changed from autoload to require, didn't count on the fact that this would eagerly require the selenium driver. Fixed.

@topfunky

Quick fix! Thanks!

@topfunky

Sorry to be obtuse, but you also removed rack-test? So there's no default driver?

@jnicklas
Collaborator

Hopefully, as soon as the RackTest driver is used, it will require the needed files. I tried this out with a script and it seemed to work.

@topfunky

Hmm. Not working for me with Rails 4, Capybara from Git, and RSpec 2.13.0. I'll try to figure it out.

 Failure/Error: visit '/'
 NameError:
   uninitialized constant Capybara::RackTest::Driver
 # ./spec/request/home_spec.rb:9:in `block (4 levels) in <top (required)>'
@jnicklas jnicklas reopened this Mar 18, 2013
@jnicklas
Collaborator

It's probably this. We override the default rack_test driver for Rails, and that one doesn't require anything.

This is actually a bit problematic, since anyone who has done that will have to require the rack-test driver, so this ends up being an API breaking change. That's not okay, so we need to fix this another way.

@topfunky

Good catch.

@jnicklas jnicklas closed this in a95518e Mar 18, 2013
@jnicklas jnicklas added a commit that referenced this issue Mar 18, 2013
@jnicklas jnicklas Delay loading selenium until driver in instantiated
Another attempt at fixing #1018
4772f50
@jnicklas jnicklas reopened this Mar 18, 2013
@jnicklas
Collaborator

Just pushed a new attempt at a fix for this.

@topfunky

That works! Thanks.

@mhoran
mhoran commented Mar 18, 2013

Works great. Thanks!

@mhoran mhoran closed this Mar 18, 2013
@mhartl
mhartl commented Mar 22, 2013

@topfunky Cool, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment