【发布时间】:2020-03-07 03:09:13
【问题描述】:
我希望有人可以提供帮助。 我正在测试三个应用程序,其中正确的行为应该是应用程序启动后,启动屏幕显示几秒钟,然后显示登录页面。
我正在尝试使用 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
感谢您的宝贵时间
【问题讨论】:
-
我已经尝试使用“睡眠”功能,但仍然没有乐趣
标签: ruby mobile automation appium