【发布时间】:2019-11-26 12:19:31
【问题描述】:
我正在尝试使用 CodeceptJS(它使用 Appium)来测试原生 Android 应用程序。我想使用方法 I.seeElement 来查看字段是否存在,但 Appium 服务器似乎只是挂起而没有错误消息。
此步骤是输入电话号码,以便用户登录。在此之前我可以单击一个按钮,但那是因为我能够使用简单的文本标识符。
这是我写的。 (I.click 方法在单击按钮时起作用。)
// in this file you can append custom step methods to 'I' object
module.exports = function() {
return actor({
login: function (I) {
I.click('ALLOW');
I.seeElement('#com.[package name removed]:id/phone');
}
});
}
这是错误信息:
[HTTP] --> POST /wd/hub/session/5e57e7af-ca1c-46bf-94ac-7e2f113a26fa/elements
[HTTP] {"using":"xpath","value":"//*[@resource-id='com.[package name removed]:id/phone']"}
[debug] [W3C (5e57e7af)] Calling AppiumDriver.findElements() with args: ["xpath","//*[@resource-id='com.[package name removed]:id/phone']","5e57e7af-ca1c-46bf-94ac-7e2f113a26fa"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"find","params":{"strategy":"xpath","selector":"//*[@resource-id='com.[package name removed]:id/phone']","context":"","multiple":true}}
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"xpath","selector":"//*[@resource-id='com.[package name removed]:id/phone']","context":"","multiple":true}}
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding '//*[@resource-id='com.[package name removed]:id/phone']' using 'XPATH' with the contextId: '' multiple: true
【问题讨论】:
标签: android xpath appium appium-android codeceptjs