坚持为自己每月写1篇笔记

Retreat Hell!
We Just Got Here.

APP测试の: MonKeyRunner___录制与回放

准备

1. 需要安装 JDK
2. 需要配置 Android_SDK 环境变量
3. 最好有 Python 编译环境

第一步

  1. 在 Android_SDK/tools 创建 monkey_record.py 脚本
  2. 通过命令 “monkeyrunner monkey_recorder.py” 运行 MonkeyRunner UI 录制界面
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date    : 2020/8/13 19:54
# @File    : monkey_record.py
# @Author  : BenLam
# @Link    : https://www.cnblogs.com/BenLam/
# @Version : PyCharm

from com.android.monkeyrunner import MonkeyRunner as _mr
from com.android.monkeyrunner.recorder import MonkeyRecorder as recorder
_devices = _mr.waitForConnection()
recorder.start(_devices)

按钮 说明
Wait 等待时间
Press a Button 发送,MENU,HOME,or SEARCH 按钮.Press,Down,or Up事件
Type Something 发送一些字符串
Fling 用来操作虚拟键盘
Export Action 将我们的脚本导出来
Refresh Display 刷新当前界面
  • 接下来你干咋弄就咋弄,MonKeyRunner就是只能识别屏幕坐标定位,并不能通过元素来定位

appcrawler

jstack

posted @ 2020-08-13 20:28  l||||||l  阅读(175)  评论(0编辑  收藏  举报