标签:
MonkeyRunner一般步骤:
首先进入monkeyrunner:
0.进入sdk/tools,monkeyrunner
1.导包from com.android.monkeyrunner import MonkeyRunner
2.连接device=MonkeyRunner.waitForConnection()
如果有多个设备,首先命令行中运行adb devices 查看可连接的设备列表
device=MonkeyRunner.waitForConnection(6,’emulator-5554′)
参数1:超时时间,单位秒,浮点数,默认是无限期地等待。
参数2:指定的设备名称deviceid,默认为当前设备(手机优先,其次为模拟器)。
3.device.installPackage("xxx.apk")
如果已经安装了可以跳过..
4.device.startActivity(component=‘包名/活动名‘)
标签:
原文地址:http://www.cnblogs.com/lyxin/p/5867708.html