微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Appium Android Windows:driver.findElementBy.name“”不能连续工作

WebElement username=driver.findElement(By.name("username")); username.sendKeys("test"); WebElement password=driver.findElement(By.name("password")); password.sendKeys("test"); WebElement loginBtn=driver.findElement(By.name("Login")); loginBtn.click(); WebElement backBtn=driver.findElement(By.tagName("Button")); backBtn.click();

当我使用上面的testing用例时,用户名已经成功运行,但是在input密码显示以下错误

debug: Appium request initiated at /wd/hub/session/71ed55ce-c3ae-46d8-9ce7-67452 0992c0a/element/1/value debug: Request received with params: {"id":"1","value":["test"]} info: Pushing command to appium work queue: ["element:setText",{"elementId":"1","text":"test"}] info: [BOOTSTRAP] [info] Got data from client: {"cmd":"action","action":"element :setText","params":{"elementId":"1","text":"test"}} info: [BOOTSTRAP] [info] Got command of type ACTION info: [BOOTSTRAP] [debug] Got command action: setText info: [BOOTSTRAP] [info] Returning result: {"value":true,"status":0} info: Responding to client with success: {"status":0,"value":true,"sessionId":"7 1ed55ce-c3ae-46d8-9ce7-674520992c0a"} POST /wd/hub/session/71ed55ce-c3ae-46d8-9ce7-674520992c0a/element/1/value 200 26 53ms - 89b debug: Appium request initiated at /wd/hub/session/71ed55ce-c3ae-46d8-9ce7-67452 0992c0a/element debug: Request received with params: {"using":"name","value":"password"} info: Pushing command to appium work queue: ["find",{"strategy":"name","selector ":"password","context":"","multiple":false}] info: [BOOTSTRAP] [info] Got data from client: {"cmd":"action","action":"find"," params":{"strategy":"name","selector":"password","multiple":false}} info: [BOOTSTRAP] [info] Got command of type ACTION info: [BOOTSTRAP] [debug] Got command action: find info: [BOOTSTRAP] [debug] Finding password using NAME with the contextId: info: [BOOTSTRAP] [info] Returning result: {"value":"No element found","status": 7} info: Responding to client with error: {"status":7,"value":{"message":"An elemen t Could not be located on the page using the given search parameters.","origValu e":"No element found"},"sessionId":"71ed55ce-c3ae-46d8-9ce7-674520992c0a"} POST /wd/hub/session/71ed55ce-c3ae-46d8-9ce7-674520992c0a/element 500 783ms - 22 3b

为什么findElement(By.name(“”))第二次不工作?

在monkeyrunner的“.installPackage()”中使用variables的问题

我们不能在Android Studio中单独启动模拟器吗?

Windows脚本来安装多个Android应用程序

在Android中发送AT命令使用atinout库

Linux:将android平台添加到cordova

使用Appium Inspector进行检查 – >“密码”字段可能没有任何名称值设置为“密码”来访问它。

尝试使用xpath访问元素,而不是像:

WebElement password = driver.findElement(By.xpath("//window[1]/scrollview[1]/secure[1]")); password.click(); password.sendKeys("psswrd");

按照以下步骤使用Appium Inspector获取xpath或其他属性

[1] Launch Appium server. [2] Check the check Box 'App Path'. [3] Click on the 'Choose' button and select your .app file location from your local,eg xyz.app [4] Now click on the 'Launch' button . Once appium server is launched,the blue color icon besides the 'Launch' button is enabled. [5] Click on the blue color icon,it will open up the appium inspector and simulator with your application :

你会看到你的应用程序的元素层次结构显示属性,如名称,xPath,值等

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐