TA的每日心情 | 奋斗 昨天 08:59 |
---|
签到天数: 1801 天 连续签到: 5 天 [LV.Master]测试大本营
|
2#
楼主 |
发表于 2017-7-11 17:04:12
|
只看该作者
- #!/usr/bin/python
- #coding=utf-8
- from com.android.monkeyrunner import MonkeyRunner,MonkeyDevice,MonkeyImage
- import time
- #连接设备
- device=MonkeyRunner.waitForConnection(3)
- #启动应用
- device.startActivity("com.yunapp/.MainActivity")
- MonkeyRunner.sleep(3)
- #向右滑动
- def scrollrightFling():
- device.touch(888,600,MonkeyDevice.DOWN)
- device.touch(200,600,MonkeyDevice.MOVE)
- device.touch(200,600,MonkeyDevice.UP)
- print "Fling right"
- def fling1():
- for i in range(2):
- scrollrightFling()
- image=device.takeSnapshot()
- image.writeToFile("E:\Monkey\yunimage\youhua"+str(i)+".png","png")
- #向左滑动
- def scrollleftFling():
- device.touch(155,800,MonkeyDevice.DOWN)
- device.touch(988,800,MonkeyDevice.MOVE)
- device.touch(988,800,MonkeyDevice.UP)
- print "Fling left"
- def fling2():
- for i in range(2):
- scrollleftFling()
- image=device.takeSnapshot()
- image.writeToFile("E:\Monkey\yunimage\zuohua"+str(i)+".png","png")
-
- fling2()
- time.sleep(2)
- fling1()
复制代码
刚刚看代码只是一部分,现在附上全部代码 |
|