我试图开始一个Watir项目,为此我创建了一个文件(test.rb)
require 'watir'
browser = Watir::Browser.new
browser.goto 'google.com'
browser.text_field(title: 'Search').set 'Hello World!'
browser.button(type: 'submit').click
puts browser.title
# => 'Hello World! - Google Search'
browser.closeenter code here
但是当我跑(ruby teste.rb)时,它给了我一个错误
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- watir/loader
(LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/2.0.0/gems/commonwatir-4.0.0/lib/watir.rb:1:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:144:in `require'
from teste.rb:1:in `<main>'
我已经安装了watir(gem install watir)。 有人能帮助我吗?
由于
答案 0 :(得分:0)
您需要bundle update
。您不应该使用Watir 6.x
commonwatir
gem依赖
答案 1 :(得分:-1)
尝试使用require "watir-webdriver"