1.UiSelector定位

text定位

根据控件的text属性

  1. android=UiSelector().text("发现")
  2. android=UiSelector().textContains("发现")
  3. android=UiSelector().textMatches("^发现*")

description定位

根据控件的content-desc属性

  1. android=UiSelector().description("发现")
  2. android=UiSelector().descriptionContains("发现")
  3. android=UiSelector().descriptionMatches("^发现*")

classname定位

  1. android=UiSelector().className("android.widget.Button").text("肌肉爆震")
  2. android=UiSelector().classNameMatches("android.widget.Button").text("肌肉爆震")

索引、实例定位

  1. android=UiSelector().index(int index) 索引
  2. android=UiSelector().instance(int instantce) 实例

特有属性定位

  1. 选择属性 checked(boolean val)
  2. 点击属性 chickable(boolean val)
  3. enabled属性 enabled(boolean val)
  4. 焦点属性 focusable(boolean val)
  5. 长按属性 longClickable(boolean val)
  6. 滚动属性 scrollable(boolean val)
  7. 选择属性 selected(boolean val)
  1. android=UiSelector().checked(True)

资源id定位

  1. android=UiSelector().resourceId("com.tencent.mm:id/b8m")
  2. android=UiSelector().resourceIdMatches("com.tencent.mm:id/b8m")

节点属性定位

  1. android=UiSelector().childSelector(Uiselector selector)
  2. android=UiSelector().fromParent(Uiselector selector)