您的位置:首页 > 产品设计 > UI/UE

android uiautomator学习(二)主要类的简单介绍 .

2014-05-07 16:42 399 查看
从别处泊来的一片短文,对初学uiautomator的人非常有帮助

说明白了各个类的主要作用

可用UiDevice表示设备

getUiDevice().pressHome();

UiSelector表示一个搜索条件以获取一个特定的组件。

UiObject appItem = new UiObject(new UiSelector()
.className("android.widget.ListView").instance(1)
.childSelector(new UiSelector().text("Apps")));

UiObject 一个UI组件,一般和UiSelector连用

UiCollection一系列的UI组件

UiCollection videos = new UiCollection(new UiSelector()
.className("android.widget.FrameLayout"));

int count = videos.getChildCount(new UiSelector()
.className("android.widget.LinearLayout"));

UiScrollable代表一个可能需要滑动先用视图才会被用户看见的组件。

UiScrollable settingsItem = new UiScrollable(new UiSelector()
.className("android.widget.ListView"));

UiObject about = settingsItem.getChildByText(new UiSelector()
.className("android.widget.LinearLayout"), "About tablet");

about.click()
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  uiautomator