watir - installation

社会主义新天地 提交于 2019-12-04 22:44:38

问题


I have installed Ruby 2, devkit & Watir. I am getting the following error. Can anyone please help me resolve this issue?

C:\devkit>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>'
irb(main):003:0>

回答1:


I'm not sure what happened then, but in case someone else runs into this problem here is what i did to get it working. Install the watir-classic (as suggested), install ffi, uninstall ffi, install ffi again. For some reason i had 2 variations of ffi (might be due to originally installing Ruby 64 bit?), but I also uninstalled 64 bit Ruby and installed 32 bit to get this all working. – breezy katt Feb 26 at 13:47




回答2:


I'm assuming you're talking about using Watir on a Windows machine. From my experience installing Ruby in the correct way is the most difficult part.

First of all, install everything as if you're on a 32 bit system. The 64 bit installation often brings unwanted issues.

That said, the ffi gem can also cause issues, so you'll have to uninstall it, and re-install with specific tags:

gem uninstall ffi
gem install ffi --platform ruby

Finally, the error that is showing LoadError: cannot load such file -- watir-classic simply means that what you're doing is trying to make use of a certain gem that is not there. In this case watir-classic, so the following should fix that:

gem install watir-classic

A complete guide on installing Watir on Windows



来源:https://stackoverflow.com/questions/15078743/watir-installation

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!