滑动代码如下:
import uiautomator2 as u2
d = u2.connect_usb("8681-A01-0xc60fcc9d")
d.app_start(package_name="com.wandoujia.phoenix2")
if __name__ == '__main__':
size = d.window_size()
x1 = int(size[0] * 0.5)
y1 = int(size[1] * 0.9)
y2 = int(size[1] * 0.15)
while True:
d.swipe(x1, y1, x1, y2)
这里可以封装个类,然后使用watcher,当某个控件出现时,就停止: