1、执行monkey脚本的命令:
adb shell monkey -f <scriptfile><event-count>
2、DispatchPointer命令
点击事件:
DispatchPointer(10,10,0,100,100,1,1,-1,1,1,0,0)
0:按下 1:弹起 100,100 为点击目标的坐标,可通过uiautomatorviewer.bat获取
3、DispatchString命令
输入字符串事件:
DispatchString(String text)
4、LaunchActivity命令
启动应用:
LaunchActivity(package,Activity)
注意:LaunchActivity(com.patientapp,com.patientapp.MainActivity)第二个参数package要与Activity连起来
5、UserWait命令
等待事件:
UserWait(1000)#等待1秒
6、DispatchPress命令
按下键值:
DispatchPress(int keycode)#keycode 66 回车键
在写monkey脚本时,前面固定有:
typ=user
count=10
speed=1.0
start data >>