简体   繁体   中英

irb gives a LoadError: cannot load watir-classic

On my laptop with Windows 7 Ultimate, I'm following the on-line Watir primer at http://watir.github.com/watirbook/chap04.html#installation ....

I've installed ruby, devkit, watir as per instructions on the page. And this looks fine:

C:\Users\Afshin>ruby -v
ruby 2.0.0p0 (2013-02-24) [i386-mingw32]

C:\Users\Afshin>gem -v
2.0.0

However, still following instruction from the online tutor page, gives me the following:

C:\Users\Afshin>irb
DL is deprecated, please use Fiddle

irb(main):001:0> require "watir"
=> true

irb(main):002:0> browser = Watir::Browser.new
LoadError: cannot load such file -- watir-classic
        from C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
        from C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/watir-4.0.2/lib/watir/loader.rb:48:in `load_driver'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/watir-4.0.2/lib/watir/loader.rb:40:in `load_driver_for'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/watir-4.0.2/lib/watir/loader.rb:8:in `new'
        from (irb):2
        from C:/Ruby200/bin/irb:12:in `<main>'

Any and all help is thoroughly appreciated!

My initial script, resulting in the mentioned error

require 'rubygems'
require 'watir'
require 'watir-webdriver'

b = Watir::Browser.new :ie

b.goto("http://www.google.be")

Removed the second line from the code

require 'rubygems'
require 'watir-webdriver'

b = Watir::Browser.new :ie

b.goto("http://www.google.be")

Now it works. Not really a solution but a work around none the less.

I did install watir-classic gem first though. I haven't tested if this is really needed for the second snippet to work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM