monkeyscript2

1.Monkey脚本一般以如下4条语句开头:
2.LaunchActivity(包名,.mainactivity 指被启动页面)
LaunchActivity(com.ringo.bugben,com.ringo.bugben.MainActivity)
3.等待事件:UserWait**(long sleeptime 等待时间 单位ms**)
userwait(2000)
4.点击事件:DispatchPointer(参数1~参数12)
DispatchPointer(10,10,**0,100,100**,1,1,-1,1,1,0,0)按下
DispatchPointer(10,10,**1,100,100**,1,1,-1,1,1,0,0)弹起
5.输入字符串事件:DispatchString(String text)
DispatchString( text)
6.按下键值:DispatchPress(int keyCode)
DispatchPress(66)回车
1.脚本要push 手机/设备里面
adb push mook.script/data/local/tmp/
2.进入手机里面
adb shell
cd data/LOCAL/tmp
3.adb shell monkey -f mook.script 2
app需要Android:exported=“true”
注:android sdk ->tool->uiautomatorviewer 获取坐标点
1136




被折叠的 条评论
为什么被折叠?



