>>> from com.android.monkeyrunner import MonkeyRunner,MonkeyDevice,MonkeyImage
>>> 连接设备:device=MonkeyRunner.waitForConnection(5,'4d12d4443032117d')
>>> 截屏:img = device.takeSnapshot()
>>> 截图命名:img.writeToFile('test.png','png')
通过adb shell截图:
adb shell /system/bin/screencap -p /sdcard/screenshot.png
adb pull /sdcard/screenshot.png d:/screenshot.png
程序暂停:MonkeyRunner.sleep(3.0)
安装程序:device.installPackage('D:\\apk\\AnTuTuTester_135.apk')
或者device.installPackage('D:/apk/AnTuTuTester_135.apk')
启动程序:device.startActivity(component='com.antutu.tester/.HardMainPage')
卸载程序:device.removePackage('com.antutu.tester')
点击屏幕:device.touch(222,388,'DOWN_AND_UP')
按键:device.press('KEYCODE_DPAD_MENU', 'DOWN_AND_UP')
输入文本:device.type('string')
抓打印: c:/android-sdk-windows/platform-tools ::adb logcat>D:/mi/log.txt
AnTuTuTester_135.apk信息:com.antutu.tester/.HardMainPage
dvb信息:com.amlogic.DTVPlayer/.DTVPlayer
home键 KEYCODE_HOME
back键 KEYCODE_BACK
send键 KEYCODE_CALL
end键 KEYCODE_ENDCALL
上导航键 KEYCODE_DPAD_UP
下导航键 KEYCODE_DPAD_DOWN
左导航 KEYCODE_DPAD_LEFT
右导航键 KEYCODE_DPAD_RIGHT
ok键 KEYCODE_DPAD_CENTER
上音量键 KEYCODE_VOLUME_UP
下音量键 KEYCODE_VOLUME_DOWN
power键 KEYCODE_POWER
camera键 KEYCODE_CAMERA
menu键 KEYCODE_MENU
阅读(1610) | 评论(0) | 转发(0) |