MonkeyRunner 录制和播放脚本,及碰到的一些问题整理
来源:互联网 发布:linux压缩命令zip 编辑:程序博客网 时间:2024/05/16 13:53
MonkeyRunner 录制和播放脚本,及碰到的一些问题整理
自己的SDK位置:比如d:\android_sdk_windows,下文都当做$SDK
1.$SDK\tools下面如果没有monkeyrunner可能是因为SDK版本过低。最好升级到2.3
2.$SDK\tools\lib一定要存在。
3.系统的环境变量里面一定要指向$SDK\tools
4.建议下载eclipse ,在eclipse里面点击DDMS监控monkeyrunner的操作
5.建议下载最新版本adb.exe,解决有的模拟器或者真机连接电脑,无法使用adb,一输入adb.exe回车就提示error ,killing
下载连接:http://android.googlecode.com/issues/attachment?aid=8293722374312378755&name=adb.exe&token=b5fbe373d5474fb0ee49239fa8accd03
6
在使用monkeyrunner之前,请大家到这里 http://www.skycn.com/search.php?ss_name=activepython&sf=index 下载activepython 并安装好它。
7.$SDK\tools\monkeyrunner.bat 运行之后,如果提示如下:
Exception in thread "main" java.lang.NoClassDefFoundError: com/android/chimpchat/ChimpChat
at com.android.monkeyrunner.MonkeyRunnerStarter.<init>(MonkeyRunnerStarter.java:60)
at com.android.monkeyrunner.MonkeyRunnerStarter.main(MonkeyRunnerStarter.java:188)
Caused by: java.lang.ClassNotFoundException: com.android.chimpchat.ChimpChat
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 2 more
说明SDK中缺少了 ChimpChat.jar,可以去 http://code.google.com/p/aster/downloads/list 下载一个最新的aster 的压缩包。这个aster 的意思是 Android System Testing Environment and Runtime. 在这个压缩包内有 aster\dist\jar\chimpchat.jar 请将这个jar包复制到你的SDK\tools\lib 目录。
#Usage: monkeyrunner recorder.py#recorder.py http://mirror.yongbok.net/linux/android/repository/platform/sdk/monkeyrunner/scripts/monkey_recorder.pyfrom 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.pyimport 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脚本的录制与回放分享
- monkeyrunner 录制脚本
- Monkeyrunner 录制脚本&回放
- MonkeyRunner_MonkeyRunner 录制和播放脚本
- monkeyrunner的录制和回放学习总结
- Android Monkeyrunner的录制和回放功能
- 碰到mysql的一些问题及解决
- 关于load runner录制脚本中遇到的一些问题及解决方案
- Android自动化测试之MonkeyRunner录制和回放脚本
- 脚本录制和参数化时的问题及技巧——上传附件
- 自动化测试时遇到的脚本录制问题及解决方法
- Android使用MediaRecorder和Camera实现视频录制及播放功能整理
- Android使用MediaRecorder和Camera实现视频录制及播放功能整理
- Android使用MediaRecorder和Camera实现视频录制及播放功能整理
- monkeyrunner(3)录制与回放脚本
- MonkeyRunner之MonkeyRecorder录制回放脚本
- 编译Linux3.0.4内核,建立源码树
- 必须改变!
- JavaScript switch 语句
- java与C++
- pageContext对象
- MonkeyRunner 录制和播放脚本,及碰到的一些问题整理
- Java应用程序与Web服务器交互
- Macromedia JRun 4 server服务启动失败
- 分布式缓存系统memcached简介与实践
- DECLARE_DYNAMIC和IMPLEMENT_DYNAMIC宏
- Java开源框架集
- 继续写起来!哪怕是转载!
- iPhone:简单的全景展示利器panoramagl
- 同步复位和异步复位的比较