运行捆绑安装后,我收到此消息“无法加载此类文件 - appium_lib”
Posted
技术标签:
【中文标题】运行捆绑安装后,我收到此消息“无法加载此类文件 - appium_lib”【英文标题】:After running bundle install I got this message "cannot load such file -- appium_lib" 【发布时间】:2021-10-25 16:13:29 【问题描述】:我只是在自动化我的 wep 应用程序时运行我的代码没有任何问题。 现在我想开始自动化我的移动应用程序,在运行 bundle install 后我收到了这个错误。我不知道在哪里可以找到此错误的解决方案。
我猜是某个 gem 安装不正确,但已经删除了所有 gem,但它没有工作。
cannot load such file -- appium_lib (LoadError)
/Users/brunobacelar/Curatio/Automation/ui_tests/ios/features/support/env.rb:3:in `require'
/Users/brunobacelar/Curatio/Automation/ui_tests/iOS/features/support/env.rb:3:in `<top (required)>'
/Users/brunobacelar/.rvm/gems/ruby-2.7.2/gems/cucumber-7.0.0/lib/cucumber/glue/registry_and_more.rb:121:in `require'
/Users/brunobacelar/.rvm/gems/ruby-2.7.2/gems/cucumber-7.0.0/lib/cucumber/glue/registry_and_more.rb:121:in `load_code_file'
/Users/brunobacelar/.rvm/gems/ruby-2.7.2/gems/cucumber-7.0.0/lib/cucumber/runtime/support_code.rb:142:in `load_file'
/Users/brunobacelar/.rvm/gems/ruby-2.7.2/gems/cucumber-7.0.0/lib/cucumber/runtime/support_code.rb:81:in `block in load_files!'
/Users/brunobacelar/.rvm/gems/ruby-2.7.2/gems/cucumber-7.0.0/lib/cucumber/runtime/support_code.rb:80:in `each'
/Users/brunobacelar/.rvm/gems/ruby-2.7.2/gems/cucumber-7.0.0/lib/cucumber/runtime/support_code.rb:80:in `load_files!'
/Users/brunobacelar/.rvm/gems/ruby-2.7.2/gems/cucumber-7.0.0/lib/cucumber/runtime.rb:260:in `load_step_definitions'
/Users/brunobacelar/.rvm/gems/ruby-2.7.2/gems/cucumber-7.0.0/lib/cucumber/runtime.rb:72:in `run!'
/Users/brunobacelar/.rvm/gems/ruby-2.7.2/gems/cucumber-7.0.0/lib/cucumber/cli/main.rb:29:in `execute!'
/Users/brunobacelar/.rvm/gems/ruby-2.7.2/gems/cucumber-7.0.0/bin/cucumber:9:in `<top (required)>'
/Users/brunobacelar/.rvm/gems/ruby-2.7.2/bin/cucumber:23:in `load'
/Users/brunobacelar/.rvm/gems/ruby-2.7.2/bin/cucumber:23:in `<main>'
/Users/brunobacelar/.rvm/gems/ruby-2.7.2/bin/ruby_executable_hooks:22:in `eval'
/Users/brunobacelar/.rvm/gems/ruby-2.7.2/bin/ruby_executable_hooks:22:in `<main>'
env.rb
# frozen_string_literal: true
require 'appium_lib'
require 'rubygems'
require 'pry'
# creating an array from the data in the YML file
APPCONSTANT=YAML.load_file('/Users/brunobacelar/Curatio/Automation/ui_tests/iOS/config/appConstants.yml')
def caps caps:
platformVersion: "14.5",
deviceName: "iPhone SE2",
platformName: 'iOS',
automationName: 'XCUITest',
bundleId: "me.curatio.st-i",
udid: "XXXXXXXX-XXXXXXXXXXXX",
newCommandTimeOut: '3600',
xcodeOrgId: 'XXXXXXXXXXX',
xcodeSigningId: 'iPhone Developer',
noReset: true end
# $driver = Appium::Driver.new(caps, true) Appium::Driver.new(caps, true) Appium.promote_appium_methods Object
【问题讨论】:
【参考方案1】:你去。你已经回答了你自己的问题。它无法加载您在 env.rb 的第 3 行指定的 appium_lib
。
通常你会确保它在你的 Gemfile 或类似文件中。仔细检查您的 Gemfile.lock 是否有相关的 gem,您的 ruby 版本是否适合您正在运行的位置,并且您还需要正确的路径
【讨论】:
以上是关于运行捆绑安装后,我收到此消息“无法加载此类文件 - appium_lib”的主要内容,如果未能解决你的问题,请参考以下文章
LoadError:无法加载此类文件 - selenium / webdriver / phantomjs
Rails错误 - 无法加载此类文件 - aws-sdk(您可能需要安装aws-sdk gem)