Appium定位

id:

 

 

 

 

Xapth:

 

 

class:

 

 

MobileBy.ACCESSIBILITY_ID

 

 

MobileBy.ANDROID_UIAUTOMATOR
text("帐号密码登录") 属性text值
resourceId("com.douban.frodo:id/left")
属性resource-id的值
description("Navigate up") 属性content-
desc的值
className("android.widget.TextView")
属性class的值

 

 

 

 

 

 

 

MobileBy.ANDROID_UIAUTOMATOR 定位方法的补充:
text属性定位
text("帐号密码登录") text属性完全相等
textContains ("帐号密码") text属性包含目标
textMatches("正则表达式") 正则匹配text属性的值
textStartsWith("帐号") text属性以“账号”开头的元素
 
resourceId 属性定位
resourceId("com.douban.frodo:id/left") resource-id属性完全相等
resourceIdMatches("正则") 正则匹配resource-id属性
 
class 属性定位
className("xxxx") class 属性完全相等
className("正则") 正则匹配class 属性
 
description属性定位
description("Navigate up") description属性完全相等
descriptionContains ("Navigate up") description属性包含目标
descriptionMatches("正则表达式") 正则匹配description属性的值
descriptionStartsWith("Navigate") description属性以“Navigate”开头的元素
 
滑动到指定元素,滑动到text属性值为"你可能感兴趣"这个元素
 
更多用法参考:https://developer.android.com/reference/android/support/test/uiautomator/
UiSelector

 

posted on 2022-02-21 11:22  阿躺  阅读(136)  评论(0)    收藏  举报