准备

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

相关文章:

  • 2021-08-03
  • 2022-02-09
  • 2022-12-23
  • 2022-12-23
  • 2022-02-10
  • 2021-06-13
  • 2021-12-16
  • 2021-08-24
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-22
  • 2021-05-01
  • 2021-12-08
  • 2021-11-24
相关资源
相似解决方案