码迷,mamicode.com
首页 > 移动开发 > 详细

appium python中的android uiautomator定位

时间:2018-07-09 14:13:12      阅读:954      评论:0      收藏:0      [点我收藏+]

标签:image   方式   com   pytho   mat   分享图片   sele   contain   模糊   

text定位:
driver.find_element_by_android_uiautomator(‘new UiSelector().text("请输入手机号")‘)

#模糊定位
driver.find_element_by_android_uiautomator(‘new UiSelector().textContains("请输入")‘)

resourceID定位:
driver.find_element_by_android_uiautomator(‘new UiSelector().resourceId("cn.com.open.mooc:id/et_phone_edit")‘)

className定位:
driver.find_element_by_android_uiautomator(‘new UiSelector().className("android.widget.EditText")‘)

index 定位:
driver.find_element_by_android_uiautomator(‘new UiSelector().index(1)‘)

className + index 方式:
driver.find_element_by_android_uiautomator(
‘new UiSelector().className("%s").childSelector(new UiSelector().index("%d"))‘)

伪xpath方法定位:

#通过同级元素定位同级元素
driver.find_element_by_android_uiautomator(‘new UiSelector().text("Custom View").fromParent(new UiSelector().text("Accessibility Service"))‘).click() 

#通过父级元素定位子集元素
driver.find_element_by_android_uiautomator(‘new UiSelector().className("android.widget.ListView").childSelector(new UiSelector().text("Custom View"))‘).click() 技术分享图片

appium python中的android uiautomator定位

标签:image   方式   com   pytho   mat   分享图片   sele   contain   模糊   

原文地址:https://www.cnblogs.com/FR-Long/p/9283383.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!