android 元素定位,利用Android UiSelector()类来定位元素。

Public methods

checkable(boolean   val)

Set the search criteria to match widgets that are   checkable.

checked(boolean   val)

Set the search criteria to match widgets that are   currently checked (usually for checkboxes).

childSelector(UiSelector selector)

Adds a child UiSelector criteria to this selector.

className(String   className)

Set the search criteria to match the class property for   a widget (for example, "android.widget.Button").

className(Class   type)

Set the search criteria to match the class property for   a widget (for example, "android.widget.Button").

classNameMatches(String   regex)

Set the search criteria to match the class property for   a widget, using a regular expression.

clickable(boolean   val)

Set the search criteria to match widgets that are   clickable.

description(String   desc)

Set the search criteria to match the content-description   property for a widget.

descriptionContains(String   desc)

Set the search criteria to match the   content-description property for a widget.

descriptionMatches(String   regex)

Set the search criteria to match the   content-description property for a widget.

descriptionStartsWith(String   desc)

Set the search criteria to match the   content-description property for a widget.

enabled(boolean   val)

Set the search criteria to match widgets that are   enabled.

focusable(boolean   val)

Set the search criteria to match widgets that are   focusable.

focused(boolean   val)

Set the search criteria to match widgets that have   focus.

fromParent(UiSelector selector)

Adds a child UiSelector criteria to this selector which   is used to start search from the parent widget.

index(int   index)

Set the search criteria to match the widget by its node   index in the layout hierarchy.

instance(int   instance)

Set the search criteria to match the widget by its   instance number.

longClickable(boolean   val)

Set the search criteria to match widgets that are   long-clickable.

packageName(String   name)

Set the search criteria to match the package name of   the application that contains the widget.

packageNameMatches(String   regex)

Set the search criteria to match the package name of   the application that contains the widget.

resourceId(String   id)

Set the search criteria to match the given resource ID.

resourceIdMatches(String   regex)

Set the search criteria to match the resource ID of the   widget, using a regular expression.

scrollable(boolean   val)

Set the search criteria to match widgets that are   scrollable.

selected(boolean   val)

Set the search criteria to match widgets that are   currently selected.

text(String   text)

Set the search criteria to match the visible text   displayed in a widget (for example, the text label to launch an app).

textContains(String   text)

Set the search criteria to match the visible text in a   widget where the visible text must contain the string in your input argument.

textMatches(String   regex)

Set the search criteria to match the visible text   displayed in a layout element, using a regular expression.

textStartsWith(String   text)

Set the search criteria to match visible text in a   widget that is prefixed by the text parameter.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值