实现在搜索框中输入查询词,并截图

上一篇 / 下一篇  2017-07-30 19:00:37 / 个人分类:移动测试

只有MonkeyRunner才可以实现截图
脚本的实现
from com.android.monkeyrunner import MonkeyRunner,MonkeyDevice,MonkeyImage
//连接设备
device=MonkeyRunner.waitForConnection(3,"设备名");3表示等待的时间
设备名通过adb  devices 得到。
启动app:device.startActivity("包名/activity的名字")
等待事件
MonkeyRunner.sleep()//
点击搜索框
device.touch(100,100,"down_and_up")
MonkeyRunner.sleep()
输入查询词
device.type('test')
MonkeyRunner.sleep()
点击回车键
device.press(KEY_ENTER",'down_and_up')
MonkeyRunner.sleep()
点击搜索按钮
device.touch(400,100,"down_and_up")
MonkeyRunner.sleep()
//截图
image=device.takeSnapshot()
保存截图片
image.write('test.png','png')











TAG:

 

评分:0

我来说两句

我的栏目

日历

« 2024-05-01  
   1234
567891011
12131415161718
19202122232425
262728293031 

我的存档

数据统计

  • 访问量: 17717
  • 日志数: 14
  • 建立时间: 2017-07-23
  • 更新时间: 2017-07-30

RSS订阅

Open Toolbar