Appium:Ruby: Load error in the gem

2019-07-10 15:34发布

I am having errors while loading this require-relative element. Any ideas how to resolve it?

I have tried searching the android sdk, for the following mentioned in the require relative, is there any file that I should be placing to get this work?>

require 'appium_lib'
require_relative './libs/adbManager'
require_relative './libs/error_handler'
require_relative './libs/android_manifest_parser'

The error:

cannot load such file -- /Users/jain/Documents/fslearning-android/Features/Support/libs/adbManager (LoadError)
/Users/jain/Documents/fslearning-android/Features/Support/hooks.rb:2:in `require_relative'
/Users/jain/Documents/fslearning-android/Features/Support/hooks.rb:2:in `<top (required)>'
/usr/local/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/lib/cucumber/rb_support/rb_language.rb:96:in `load'
/usr/local/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/lib/cucumber/rb_support/rb_language.rb:96:in `load_code_file'
/usr/local/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/lib/cucumber/runtime/support_code.rb:142:in `load_file'
/usr/local/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/lib/cucumber/runtime/support_code.rb:84:in `block in load_files!'
/usr/local/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/lib/cucumber/runtime/support_code.rb:83:in `each'
/usr/local/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/lib/cucumber/runtime/support_code.rb:83:in `load_files!'
/usr/local/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/lib/cucumber/runtime.rb:253:in `load_step_definitions'
/usr/local/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/lib/cucumber/runtime.rb:61:in `run!'
/usr/local/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/lib/cucumber/cli/main.rb:32:in `execute!'
/usr/local/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/bin/cucumber:8:in `<top (required)>'
/usr/local/bin/cucumber:22:in `load'
/usr/local/bin/cucumber:22:in `<main>'

1条回答
乱世女痞
2楼-- · 2019-07-10 15:59

You requested me for help, but other than the error you published originally I can just give you some general advise since I have no experience with appium itself and the prerequisites are too high to try.

Where did you get the code for the require_relatives you are making ? I can't find much documentation online. They should refer to gems or ruby files. In the case of a gem (like require 'appium_lib') you need to meet the prerequisites (iOs only ?, gem installed ? etc), in case of a ruby script file you can check where the file is located in your filesystem and you'd better make use of the fileextension .rb.

eg require_relative './libs/adbManager.rb' would be a file that is located in a subfolder libs of your main script called adbManager.rb.

If it would be part of appium it would rather be something like

require 'appium_lib/adbManager'
查看更多
登录 后发表回答