Monkey脚本参数详解

LaunchActivity(pkg_name, cl_name):启动应用的Activity。参数:包名和启动的Activity。

Tap(x, y, tapDuration): 模拟一次手指单击事件。参数:x,y为控件坐标,tapDuration为点击的持续时间,此参数可省略。

DispatchPress(keyName): 按键。参数: keycode。 详细的Android Keycode列表: http://blog.csdn.net/feizhixuan46789/article/details/16801429

RotateScreen(rotationDegree, persist): 旋转屏幕。 参数:rotationDegree为旋转角度, e.g. 1代表90度;persist表示旋转之后是否固定,0表示旋转后恢复,非0则表示固定不变。

DispatchFlip(true/false): 打开或者关闭软键盘。

LongPress(): 长按2秒。

PressAndHold(x, y, pressDuration): 模拟长按事件。

DispatchString(input): 输入字符串。

Drag(xStart, yStart, xEnd, yEnd, stepCount): 用于模拟一个拖拽操作。

PinchZoom(x1Start, y1Start, x1End, y1End, x2Start, y2Start, x2End, y2End, stepCount): 模拟缩放手势。

UserWait(sleepTime): 休眠一段时间

DeviceWakeUp(): 唤醒屏幕。

PowerLog(power_log_type, test_case_status): 模拟电池电量信息。

WriteLog(): 将电池信息写入sd卡。

RunCmd(cmd): 运行shell命令。

DispatchPointer(downtime,eventTime,action,x,yxpressure,size,metastate,xPrecision,yPrecision,device,edgeFlags): 向指定位置,发送单个手势。

DispatchPointer(downtime,eventTime,action,x,yxpressure,size,metastate,xPrecision,yPrecision,device,edgeFilags): 发送按键消息。

LaunchInstrumentation(test_name,runner_name): 运行一个instrumentation测试用例。

DispatchTrackball: 模拟发送轨迹球事件。

ProfileWait: 等待5秒。

StartCaptureFramerate(): 获取帧率。

EndCaptureFramerate(input): 结束获取帧率。

发布了91 篇原创文章 · 获赞 15 · 访问量 21万+

猜你喜欢

转载自blog.csdn.net/qq_38776582/article/details/102486646