简体   繁体   English

无法使用appium定位元素

[英]Unable to locate an element using appium

I was trying to select a particular element in my mobile app to enter mobile number.in my app i have done all other works..but i can't able to locate my Mobile number field to enter Mobile number. 我试图在移动应用程序中选择一个特定的元素来输入移动电话号码。在我的应用程序中,我已经完成了所有其他工作..但是我无法找到我的移动电话号码字段来输入移动电话号码。 currently it was performing the click operation on to a country code spinner prefix to my mobile number field.. 目前,它正在对我的手机号码字段的国家/地区代码微调框前缀执行点击操作。

The input field in my app is given below 我的应用程序中的输入字段如下

在此处输入图片说明

The UI automator view is given below UI自动视图如下

在此处输入图片说明

The codes i tried are 我试过的代码是

 driver.findElement(By.xpath("//android.widget.EditText[@text='Mobile Number']")).sendKeys("8129497946");

and

driver.findElement(By.xpath("//android.widget.EditText[contains(@resource-id,'ext-element-65')']")).sendKeys("8129497946");

any solutions? 有什么解决办法吗?

find_element(id: 'ext-element-65').sendKeys("8129497946")

This is how it is usually written. 通常是这样写的。 Please make sure you select driver.findelement by id , in case your giving resource-id as locator. 请确保通过id选择driver.findelement ,以防您将resource-id作为定位符。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM