MonkeyRunner_MonkeyRunner 录制和播放脚本
来源:互联网 发布:淘宝的兄弟翡翠假货 编辑:程序博客网 时间:2024/06/05 16:03
#Usage: monkeyrunner recorder.py
#recorder.py http://mirror.yongbok.net/linux/android/repository/platform/sdk/monkeyrunner/scripts/monkey_recorder.py
from com.android.monkeyrunner import MonkeyRunner as mrfrom com.android.monkeyrunner.recorder import MonkeyRecorder as recorderdevice = mr.waitForConnection()recorder.start(device)
#END recorder.py
#Press ExportAction to save recorded scrip to a file#Example of result:#PRESS|{'name':'MENU','type':'downAndUp',}#TOUCH|{'x':190,'y':195,'type':'downAndUp',}#TYPE|{'message':'',}
============================================================================================
#Usage: monkeyrunner playback.py "myscript"
#playback.py http://mirror.yongbok.net/linux/android/repository/platform/sdk/monkeyrunner/scripts/monkey_playback.py
import sysfrom com.android.monkeyrunner import MonkeyRunner# The format of the file we are parsing is very carfeully constructed.# Each line corresponds to a single command. The line is split into 2# parts with a | character. Text to the left of the pipe denotes# which command to run. The text to the right of the pipe is a python# dictionary (it can be evaled into existence) that specifies the# arguments for the command. In most cases, this directly maps to the# keyword argument dictionary that could be passed to the underlying# command. # Lookup table to map command strings to functions that implement that# command.CMD_MAP = { 'TOUCH': lambda dev, arg: dev.touch(**arg), 'DRAG': lambda dev, arg: dev.drag(**arg), 'PRESS': lambda dev, arg: dev.press(**arg), 'TYPE': lambda dev, arg: dev.type(**arg), 'WAIT': lambda dev, arg: MonkeyRunner.sleep(**arg) }# Process a single file for the specified device.def process_file(fp, device): for line in fp: (cmd, rest) = line.split('|') try: # Parse the pydict rest = eval(rest) except: print 'unable to parse options' continue if cmd not in CMD_MAP: print 'unknown command: ' + cmd continue CMD_MAP[cmd](device, rest)def main(): file = sys.argv[1] fp = open(file, 'r') device = MonkeyRunner.waitForConnection() process_file(fp, device) fp.close(); if __name__ == '__main__': main()
- MonkeyRunner_MonkeyRunner 录制和播放脚本
- monkeyRunner的录制和播放脚本
- 音频录制和播放
- 播放和录制音频
- 电脑音频录制和播放
- android录制和播放视频
- 录制音频和播放音频
- recordview视频录制和播放
- Android语音录制和播放
- MonkeyRunner 录制和播放脚本,及碰到的一些问题整理
- 基于JMF录制和播放视频源码
- iphone实现声音的录制和播放
- iPhone中录制和播放声音
- iphone实现声音的录制和播放
- iOS audio queue 播放和录制音频
- IOS 实现声音的录制和播放
- iphone实现声音的录制和播放
- AudioRecord实现"助听器" ,录制和播放功能
- cocos2d-x学习之连帧动画制作
- HDU 1698 Just a Hook
- form表单javascript验证(防遗忘)
- ActivityManager框架解析
- 华为boss力荐公司高层看的一篇文章,真的很经典!!!
- MonkeyRunner_MonkeyRunner 录制和播放脚本
- (转)Ubuntu 10.04开机画面低分辨率问题解决方案
- VIM选择文本块
- 如何在CentOS上安装电影播放器
- z-index相关问题
- MonkeyRunner_采用MonkeyRunner自动化测试
- 女测试工程师的成长(1-4)
- Android UI【android 自定义dialog 多选项对话框】
- 网络质量指标及测试工具iperf