uiautomator: UiWatcher
上一篇 /
下一篇 2014-07-14 18:01:27
/ 个人分类:android
UiObject:操作对象
UiCollection: 对象集合
UiScrollable: 滚动对象
UiDevice: 操作设备
UiSelector: 选择条件
UiWatcher: 监听器
public boolean checkForCondition(); 中断监听检查条
监听器操作:
void registerWatcher(String name, UiWatcher watcher);
void removeWatcher(String name);
void resetWatcherTriggers();
void runWatchers();
监听器要在中断代码之前运行
boolean hasAnyWatcherTriggered();
boolean hasWatcherTriggered(String watcherName); 检查某个特定的监听器是否触发过
重置监听与检查监听运行实例
UiDevice.getInstance().resetWatcherTriggers();
boolean phone = UiDevice.getInstance().hasWatcherTriggered("answerThePhone");
if(phone == true)
{
System.out.println("电话监听器运行过了");
}
收藏
举报
TAG: