Android平台自动测试之Monkey测试工具(8)
发表于:2016-09-12来源:cnblogs作者:cnb_yangwei点击数:
标签:
7 device = MonkeyRunner.waitForConnection() 8 9 # Installs the Android package. Notice that this method returns a boolean, so you can test 10 11 # to see if the installation worked. 12 13 device.insta
7 device = MonkeyRunner.waitForConnection()
8
9 # Installs the Android package. Notice that this method returns a boolean, so you can test
10
11 # to see if the installation worked.
12
13 device.installPackage('./ApiDemos.apk')
14
15
16 # Runs the component
17
18 device.startActivity(component='com.example.android.apis/.ApiDemos')
19
20
21 # Presses the Menu button
22
23 device.press('KEYCODE_MENU','DOWN_AND_UP')
24
25
26 # Takes a screenshot
27
28 result = device.takeSnapshot()
29
30
31 # Writes the screenshot to a file
32
原文转自:http://www.cnblogs.com/iloverain/p/5604172.html