我希望有人能提供帮助。 我正在测试“三个应用程序”,该应用程序启动后应具有正确的行为,启动屏幕显示几秒钟,然后显示登录页面。
我正在尝试使用appium将其自动化,但是一旦自动测试打开了初始屏幕,测试就会结束。 出现此错误消息:
NoSuchElementError: An element could not be located on the page using the given search parameters. at AndroidUiautomator2Driver.findElOrEls (C:\Users\zminhas\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-android-driver\lib\commands\find.js:75:11)
这是我的env.rb代码:
require "appium_lib"
require "pry"
opts = {
caps: {
deviceName: :Anyname,platformName: :Android,app: 'C:\Users\zminhas\Desktop\three_app_automation\features\support\biometrics.apk',appPackage: "com.hutchison3g.planet3",appactivity: ".SplashScreenactivity",noReset: true
},appium_lib: {
#wait_timeout: 30
}
}
Appium::Driver.new(opts,true).start_driver
Appium.promote_appium_methods Object
还有我的hooks.rb代码:
Before do
$driver.start_driver
end
After do
$driver.driver_quit
end
这是完整的结果屏幕:
$ cucumber
*** WARNING: You must use ANSICON 1.31 or higher (https://github.com/adoxa/ansicon/) to get coloured output on Windows
Feature: All external URLs work as expected within the More Tab
2019-11-11 12:08:13 WARN Selenium [DEPRECATION] Selenium::WebDriver::Error::TimeOutError is deprecated. Use Selenium::WebDriver::Error::TimeoutError (ensure the driver supports W3C WebDriver specification) instead.
Scenario: test # features/more_tab.feature:3
Given I see the enter number screen # features/step_definitions/more_tab_steps.rb:1
An element could not be located on the page using the given search parameters. (Selenium::WebDriver::Error::NoSuchElementError)
NoSuchElementError: An element could not be located on the page using the given search parameters.
at AndroidUiautomator2Driver.findElOrEls (C:\Users\zminhas\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-android-driver\lib\commands\find.js:75:11)
./features/step_definitions/more_tab_steps.rb:2:in `"I see the enter number screen"'
features/more_tab.feature:4:in `Given I see the enter number screen'
Failing Scenarios:
cucumber features/more_tab.feature:3 # Scenario: test
1 scenario (1 failed)
1 step (1 failed)
0m14.888s
谢谢您的时间