Android自动化测试MonkeyRunner
这两天正在学习Android的自动化测试工具MonkeyRunner,以下是我的一些学习记录:
1.首先启动emulator,然后把手机设备连接至电脑。
fromcom.android.monkeyrunnerimportMonkeyRunner,MonkeyDevice
device=MonkeyRunner.waitForConnection()//连接手机设备
device.installPackage("../XX.apk")//安装apk包到手机设备
device.startActivity
(component="com.example.android.apis/com.example.android.apis.ApiD
emos")//以ApiDemos为例,打开ApiDemos
device.reboot()//手机设备重启
device.touch(300,300,'DOWN_AND_UP')
MonkeyRunner.alert("hello")//在emulator上会弹出消息提示
device.press('KEYCODE_BACK','DOWN_AND_UP')
device.type('hello')//向编辑区域输入文本'hello'
相关推荐
YBsisterchang 2014-02-07
abdstime 2020-05-30
lucialee 2020-01-11
goodby 2020-01-09
chichichi0 2020-01-08
goodby 2019-12-18
goodby 2019-12-16
mohanzb 2019-12-02
lucialee 2019-11-10
不羈 2010-11-08
mohanzb 2011-08-09
GLMINECSDN 2011-05-30
abdstime 2019-10-23
zongzi4302 2015-06-15
qianbingbing 2015-06-15
YBsisterchang 2015-06-15
moneyispaper 2015-06-12
mingmingini 2012-01-04
goodby 2019-09-08