Appium:Nokogiri在运行测试用例时出现加载错误

时间:2014-11-04 08:48:50

标签: ruby nokogiri appium

我已经从Ruby 1.8.7将Ruby版本升级到2.1.0并安装了所有依赖项以使用Ruby运行示例Appium测试用例。但是我在运行测试用例时遇到了加载nokogiri的问题。

我正在使用
操作系统:Mac OS - 1.9.2
Ruby:2.1.0
Appium:1.2.0
Nokogiri:1.6.3.1
这适用于Ruby:1.8.7。

错误:

Users/.rvm/gems/ruby-2.1.0/ruby/2.1.0/gems/nokogiri-1.6.3.1/lib/nokogiri.rb:29:in `require': dlopen(/Users/.rvm/gems/ruby-2.1.0/ruby/2.1.0/gems/nokogiri-1.6.3.1/lib/nokogiri/nokogiri.bundle, 9): Library not loaded: /Users/.rvm/rubies/ruby-2.1.0/lib/libruby.2.1.0.dylib (LoadError)
  Referenced from: /Users/.rvm/gems/ruby-2.1.0/ruby/2.1.0/gems/nokogiri-1.6.3.1/lib/nokogiri/nokogiri.bundle
  Reason: image not found - /Users/.rvm/gems/ruby-2.1.0/ruby/2.1.0/gems/nokogiri-1.6.3.1/lib/nokogiri/nokogiri.bundle
    from /Users/.rvm/gems/ruby-2.1.0/ruby/2.1.0/gems/nokogiri-1.6.3.1/lib/nokogiri.rb:29:in `rescue in <top (required)>'
    from /Users/.rvm/gems/ruby-2.1.0/ruby/2.1.0/gems/nokogiri-1.6.3.1/lib/nokogiri.rb:25:in `<top (required)>'
    from /Users/.rvm/gems/ruby-2.1.0/ruby/2.1.0/gems/appium_lib-4.1.0/lib/appium_lib/driver.rb:4:in `require'
    from /Users/.rvm/gems/ruby-2.1.0/ruby/2.1.0/gems/appium_lib-4.1.0/lib/appium_lib/driver.rb:4:in `<top (required)>'
    from /Users/.rvm/gems/ruby-2.1.0/ruby/2.1.0/gems/appium_lib-4.1.0/lib/appium_lib.rb:28:in `require_relative'
    from /Users/.rvm/gems/ruby-2.1.0/ruby/2.1.0/gems/appium_lib-4.1.0/lib/appium_lib.rb:28:in `<top (required)>'
    from /Users/Documents/rslRuby/li_workspace/flagship_native_tests/UITestFramework/selenium/base/LI_framework.rb:32:in `require'
    from /Users/Documents/rslRuby/li_workspace/flagship_native_tests/UITestFramework/selenium/base/LI_framework.rb:32:in `<top (required)>'
    from /Users/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from samle_tests/sign_in_test.rb:10:in `<main>'

1 个答案:

答案 0 :(得分:0)

可能的修复1:

这通常发生在宝石链接错误时,我建议尝试通过rvm重新安装ruby。

rvm reinstall 2.1
rvm use 2.1

通过运行(在你的apps目录中)确保所有宝石都是最新的

bundle install

可能的修复2:

另一个常见问题是如果您已经完成了重新安装rvm,请以root用户身份安装rvm。

您可以通过运行

卸载rvm
rvm implode

按照网站上的步骤install rvm