(MTBF)python的uiautomator中watcher的作用域和用法

如果把python的UIautomator用类封装后,在整个case的过程中,一定要使用launcher来启动应用,那么在launcher实现类的init方法中加入watcher,整个case就都会受到该watcher的影响,不用非得把wather加在prepare中。

实现方法如下:

def __init__(self):
self.dut = device_impl.getDevice(Constant.DEVICE_SERIAL)
self.d = self.dut
self.d.watcher("allow_wcher").when(resourceId="ALLOW").click(resourceId="ALLOW")

self.d.watchers.run()

posted @ 2017-05-15 21:49  魅力咔咔  阅读(1080)  评论(0编辑  收藏  举报