标签:uiautomator
当创建一个UiScrollable对象时,如果指定的参数是new UiSelector().scrollable(true),那么会出现以下问题
//Find out the new added note entry UiScrollable noteList = new UiScrollable( new UiSelector().scrollable(true)); //would be null if the scrollable widget's not more than one page UiObject note = null;
note = noteList.getChildByText(new UiSelector().className("android.widget.TextView"), "Note1", true);
<pre name="code" class="java"> assertThat(note,notNullValue());note.longClick();
//Find out the new added note entry UiScrollable noteList = new UiScrollable( new UiSelector().scrollable(true)); UiObject note = null;
if(noteList.exists()) { note = noteList.getChildByText(new UiSelector().className("android.widget.TextView"), "Note1", true); } else { note = new UiObject(new UiSelector().text("Note1")); } assertThat(note,notNullValue()); note.longClick();
//Find out the new added note entry UiScrollable noteList = new UiScrollable( new UiSelector().className("android.widget.ListView")); UiObject note = null; note = noteList.getChildByText(new UiSelector().className("android.widget.TextView"), "Note1", true); assertThat(note,notNullValue()); note.longClick();
UIAutomator中滚动ListView获得目标TextView控件对象的经验点滴
标签:uiautomator
原文地址:http://blog.csdn.net/zhubaitian/article/details/39509181