Android平台自动测试之Monkey测试工具(12)

发表于:2016-09-12来源:cnblogs作者:cnb_yangwei点击数: 标签:
23 device.press(KEYCODE_DPAD_DOWN,DOWN_AND_UP) 24 25 device.press(KEYCODE_DPAD_DOWN,DOWN_AND_UP) 26 27 device.press(KEYCODE_DPAD_DOWN,DOWN_AND_UP) 28 29 # Takes a screenshot 30 31 result = device.take

23 device.press('KEYCODE_DPAD_DOWN','DOWN_AND_UP')
24 
25 device.press('KEYCODE_DPAD_DOWN','DOWN_AND_UP')
26 
27 device.press('KEYCODE_DPAD_DOWN','DOWN_AND_UP')
28 
29 # Takes a screenshot
30 
31 result = device.takeSnapshot()
32 
33 # Writes the screenshot to a file
34 
35 result.writeToFile('./shotend.png','png')
复制代码
复制代码

2、  将画面定位在Apidemos的首页,并将光标定位在第一项上。

3、  在$Android_Root\tools目录下运行一下命令:

monkeyrunner monkeyrunnerprogram1.py

4、在运行过程中我们可以看见光标不断向下移动,并且可以在当前目录下我们自定义的截图:

运行前:shotbegin.png

原文转自:http://www.cnblogs.com/iloverain/p/5604172.html

...

热门标签