新手问题 Watir 5.0 测试加载报错,希望大家帮帮

ghn645568344 · 2015年10月13日 · 最后由 ghn645568344 回复于 2015年10月13日 · 2091 次阅读

Watir 5.0 测试加载报错,希望大家帮帮 程序如下:

require "watir"
browser = Watir::Browser.new

报错:

LoadError: cannot load such file -- watir-webdriver/locators/element_locator
    from /usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `require'
    from /usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
    from /usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require'
    from /usr/local/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.9.0/lib/watir-webdriver.rb:13:in `<top (required)>'
    from /usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/lib/ruby/gems/2.1.0/gems/watir-5.0.0/lib/watir/loader.rb:41:in `load_driver'
    from /usr/local/lib/ruby/gems/2.1.0/gems/watir-5.0.0/lib/watir/loader.rb:33:in `load_driver_for'
    from /usr/local/lib/ruby/gems/2.1.0/gems/watir-5.0.0/lib/watir/loader.rb:6:in `initialize'
    from (irb):5:in `new'
    from (irb):5
    from /usr/local/bin/irb:11:in `<main>'

我的 gem:

watir (5.0.0)
watir-webdriver (0.9.0)

ruby 版本 ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]

cannot load such file -- watir-webdriver/locators/element_locator

看起来你需要 https://github.com/watir/watir-webdriver

#1 楼 @huacnlee 已经安好了 watir-webdriver (0.9.0) 但是加载 watir-webdriver 会报错


irb(main):001:0> require 'watir-webdriver'
LoadError: cannot load such file -- watir-webdriver/locators/element_locator
    from /usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `require'
    from /usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
    from /usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require'
    from /usr/local/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.9.0/lib/watir-webdriver.rb:13:in `<top (required)>'
    from /usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `require'
    from /usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
    from /usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require'
    from (irb):1
    from /usr/local/bin/irb:11:in `<main>'

需要 登录 后方可回复, 如果你还没有账号请 注册新账号