演示1 正则表达式技巧实例——选择闹钟
/**
* 演示闹钟实例
* 1.打开闹钟界面
* 2.创建两个闹钟
* 3.删除第二个闹钟
* 4.验证是否删除成功
* @throws UiObjectNotFoundException
* */
public void testClick() throws UiObjectNotFoundException{
//初始化用例环境
UiDevice.getInstance().pressBack();
UiDevice.getInstance().pressBack();
UiDevice.getInstance().pressBack();
UiDevice.getInstance().pressHome();
//点击闹钟应用
UiObject alarm_clock = new UiObject(new UiSelector().
textMatches("Alarm Clock Xtreme"));
alarm_clock.clickAndWaitForNewWindow();
//进入闹钟后点击添加闹钟
UiObject add = new UiObject(new UiSelector()
.resourceIdMatches(".*id/footer_textview"));
add.click();
//点击完成,创建闹钟
UiObject finish = new UiObject(new UiSelector()
.text("完成"));
finish.click();
//新建第二个闹钟