【发布时间】:2013-06-30 12:15:05
【问题描述】:
UiSelector 允许您通过文本、textStartsWith、包含等获取 EditText 字段:
UiObject obj = new UiObject(new UiSelector().text(text));
http://developer.android.com/tools/help/uiautomator/UiSelector.html
但是如何获得第二个文本字段?碰巧该字段没有任何文本或描述。如果我只是这样做
UiObject textField = new UiObject(new UiSelector().index(index));
然后它返回一个不是带有索引的 EditText 的字段。
谢谢!
【问题讨论】:
-
如果您知道resourceId,您可以使用它来选择文本字段。 UiSelector#resourceId.
标签: android testing automation android-uiautomator