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