首页 > 其他 > 详细

常用操作

时间:2021-07-09 12:51:25      阅读:8      评论:0      收藏:0      [点我收藏+]
 

备注:电脑安装uiautomator2和weditor后,要记得运行python -m uiautomator2 init,这样手机端会自动安装ATX端

1、录屏:

device = u2.connect()
now = str(datetime.datetime.now()).replace(":", "_")
r = device.screenrecord("Mp4/" + now + ".mp4")
r.stop()

  

2、截屏

device.screenshot("test.png")

  

3、模拟按键

切换到主页

device.press("home")

 

4、滑动(从y2位置滑动到y1)

device.swipe(x2, y2, x1, y1)

  

5、监控(注册“系统操作”名称,当出现“确定”文字时进行点击操作)

device.watcher("系统操作").when("确定").click()

  

 

常用操作

原文:https://www.cnblogs.com/fengliting/p/14988578.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!