watir - 安装 [英] watir - installation
问题描述
我已经安装了 Ruby 2、devkit &瓦蒂尔.我收到以下错误.谁能帮我解决这个问题?
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>
推荐答案
我假设您正在谈论在 Windows 机器上使用 Watir.根据我的经验,以正确的方式安装 Ruby 是最困难的部分.
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.
首先,像在 32 位系统上一样安装所有内容.64 位安装通常会带来不必要的问题.
First of all, install everything as if you're on a 32 bit system. The 64 bit installation often brings unwanted issues.
也就是说,ffi
gem 也会导致问题,因此您必须卸载它,并使用特定标签重新安装:
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
最后,显示 LoadError: cannot load such file -- watir-classic
的错误只是意味着您正在尝试使用不存在的某个 gem.在这种情况下 watir-classic
,所以以下应该解决这个问题:
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
这篇关于watir - 安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!