1.用法:MonkeyRunner.alert(message,title,okTitle)

执行当前脚本弹出一个警示对话框,用户关闭对话框后脚本才结束。

message:会话弹出的内容
title:会话标题,默认为alert
okTitle:会话确认按钮,默认为ok
返回值:nothing。
2、com.android.monkeyrunner.MonkeyDevice.broadcastIntent
对设备发送一个广播信号。
用法:MonkeyDevice.broadcastIntent(uri,action,data,mimetype,categories,extras,component,flags)
uri:信号的uri
action:
data
mimetype
categories
extras
component
flags
返回值: nothing。
3、com.android.monkeyrunner.MonkeyRunner.choice
显示一个对话框,让用户从一列选项中选择一个单一的选项。
用法:MonkeyRunner.choice(message,choices,title)
message:显示在对话框中的提示信息。
choices:一个迭代的包含一系列选择的python类型
title:对话框的标题,默认为input
返回值: The 0-based numeric offset of the selected item in the iterable.
4、com.android.monkeyrunner.MonkeyImage.convertToBytes
将图片转换为其他特殊的格式,将结果作为字符串返回,用这个方法将像素存取为特殊的格式,输出的字符串是一种更好的表现。
用法:MonkeyImage.convertToBytes(format)
format:目标格式,默认值为png。
返回值: 目标图片格式的字符串
5、com.android.monkeyrunner.MonkeyDevice.drag
在设备屏幕上模拟拖曳。
用法:MonkeyDevice.drag(start,end,duration,steps)
start:拖曳开始坐标 - The starting point for the drag (a tuple (x,y) in pixels)
end:拖曳结束坐标点- The end point for the drag (a tuple (x,y) in pixels
duration:持续时间 - Duration of the drag in seconds (default is 1.0 seconds)
steps:拖曳步骤- The number of steps to take when interpolating points. (default is 10)
Returns: returns nothing.
6、com.android.monkeyrunner.MonkeyDevice.getHierarchyViewer
获取设备的显示层次。
用法:MonkeyDevice.getHierarchyViewer()
返回值:一个HierarchyViewer类型的对象。
7、com.android.monkeyrunner.MonkeyDevice.getProperty
在设备上给出变量的名称,返回变量的值。
用法:MonkeyDevice.getProperty(key)
key:变量的名称(key列表参加)
返回值:变量的值The variable's value
8、com.android.monkeyrunner.MonkeyImage.getRawPixel
在x,y位置处获取一个单个的ARGB像素,参数x,y都是基于0坐标,表示一个像素尺寸,x向右增益,y向下增益,这个方法返回一个数组。
用法:MonkeyImage.getRawPixel(x,y)
x:x偏移
y:y偏移
Returns: A tuple of (A, R, G, B) for the pixel. Each item in the tuple has the range 0-255.
9、com.android.monkeyrunner.MonkeyImage.getRawPixelInt
同上.getRawPixel,只是返回的是一个整型。
用法:MonkeyImage.getRawPixelInt(x,y)
x:x偏移
y:y偏移
Returns: An unsigned integer pixel for x,y. The 8 high-order bits are A, followedby 8 bits for R, 8 for G, and 8 for B.
10、com.android.monkeyrunner.MonkeyImage.getSubImage
复制一个图片的矩形区域。
用法:MonkeyImage.getSubImage(rect)
rect:A tuple (x, y, w, h),x,y指定矩形区域的左上角,w为矩形宽,h为矩形高
返回:一个表示复制区域的图形对象。a MonkeyImage object representing the copied region.
11、com.android.monkeyrunner.MonkeyDevice.getSystemProperty
getProperty的同义。
用法:MonkeyDevice.getSystemProperty(key)
key:系统变量的名称。
返回:系统变量的值
12、com.android.monkeyrunner.MonkeyRunner.help
显示monkeyrunner的API。
用法:MonkeyRunner.help(format)
format:The desired format for the output, either 'text' for plain text or 'html' for HTML markup.
Returns: A string containing the help text in the desired format
13、com.android.monkeyrunner.easy.By.id
id - The identifier of the object.
Returns: returns nothing.
14、com.android.monkeyrunner.MonkeyRunner.input
显示一个接受的对话框,用户点击对话按钮中的一个菜结束。
用法:MonkeyRunner.input(message,initialValue,title,okTitle,cancelTitle)
message:对话框显示的信息。The prompt message to display in the dialog.
initialValue:提供给用户的初始化值,默认为空字符串。The initial value to supply to the user. The default is an empty string)
title:对话标题,默认为input。The dialog's title. The default is 'Input'
okTitle:The text to use in the dialog's confirmation button. The default is 'OK'.
cancelTitle:The text to use in the dialog's 'cancel' button. The default is 'Cancel'.
返回: The test entered by the user, or None if the user canceled the input;。
15、com.android.monkeyrunner.MonkeyDevice.installPackage
在设备上安装应用包,如果该包已经存在,那么体会掉原来的。
用法:MonkeyDevice.intallPackage(path)
path:安装包在本地的路径已经文件名。
返回值:如果安装成功返回true,否则false。
16、com.android.monkeyrunner.MonkeyDevice.instrument
运行测试设备的指定包。
用法:MonkeyDevice.instrument(className,args)
className:测试设备要执行的类,格式为packagename/classname,
args:不会翻译。A map of strings to objects containing the arguments to pass to this instrumentation (default value is None).
返回:单个键值对,key-value,key为steam,value为包含测试输出的字符串。
17、com.android.monkeyrunner.MonkeyRunner.loadImageFromFile
Loads a MonkeyImage from a file.不会翻译
用法:MonkeyRunner.loadImageFromFile(path)
path:文件的路径,路径为电脑端路径。
返回:表示指定文件的MonkeyImage对象。
18、com.android.monkeyrunner.MonkeyDevice.press
给指定key发送一个key事件。
用法:MonkeyDevice.press(name,type)
name:keycode(参考android.view.KeyEvent)
type:触摸事件类型,如DOWN_AND_UP。
return:nothing。
19、com.android.monkeyrunner.MonkeyDevice.reboot
重启指定设备进入指定加载模式。
用法:MonkeyDevice.reboot(into)
into:bootloader, recovery, or None
return:nothing
20、com.android.monkeyrunner.MonkeyDevice.removePackage
从设备删除指定的包,包括相关的数据已经缓存。
用法:MonkeyDevice.removePackage(package)
package:指定要删除的包名
return:删除成功则返回true。
21、com.android.monkeyrunner.MonkeyImage.sameAs
Compare this MonkeyImage object to aother MonkeyImage object.
用法:MonkeyImage.sameAs(other,percent)
other:其他MonkeyImage对象
percent:百分比,取值为0.0-1.0
return:如果一致返回true
22、com.android.monkeyrunner.MonkeyDevice.shell
执行adb shell命令并返回结果。
用法:MonkeyDevice.shell(cmd)
cmd:要执行的adb shell命令
return:命令的输出
23、com.android.monkeyrunner.MonkeyRunner.sleep
暂停当前运行进程指定的时间。
用法:MonkeyRunner.sleep(seconds)
seconds:暂停时间
return:nothing
24、com.android.monkeyrunner.MonkeyDevice.startActivity
在设备上开始一个活动,
用法:MonkeyDevice.startActivity(uri,action,data,mimetype,categories,extras,component,flags)
uri:
action:
data:
mimetype:
categories:
extras:
component:
flags:
return:nothings
25:com.android.monkeyrunner.MonkeyDevice.takeSnapshot
获取设备的屏幕缓存
用法:MonkeyDevice.takeSnapshot()
return:一个MonkeyImage对象。
26、com.android.monkeyrunner.MonkeyDevice.touch
对指定位置发送一个触摸事件
用法:MonkeyDevice.touch(x,y,type)
x:
y:
type:触摸事件类型。
return:nothing
27、com.android.monkeyrunner.MonkeyDevice.type
从键盘键入指定的字符串,这相当于字符串的每一个字符都执行一次press(keycode,DOWN_AND_UP)方法。
用法:MonkeyDevice.type(message)
message:发送到键盘的字符串
Returns: returns nothing.
28、com.android.monkeyrunner.MonkeyRunner.waitForConnection
等待电脑连接到设备。
用法:MonkeyRunner.waitForConnection(timeout,deviceId)
timeout:等待的时间,默认为无限期
deviceId:指定设备名称的一个规定表达式
Returns: 一个表示已经连接的设备对象,A MonkeyDevice object
29、com.android.monkeyrunner.MonkeyDevice.wake
唤醒设备的屏幕
用法:MonkeyDevice.wake()
Returns: returns nothing.
30、com.android.monkeyrunner.MonkeyImage.writeToFile
将MonkeyImage对象写入一个文件,
用法:MonkeyImage.writeToFile(path,format)
path:输入的文件名,可选择的包含路径
format:目标格式,默认为png。
return:如果输出成功返回true。

【monkeyrunner】monkeyrunner 的的方法介绍的更多相关文章

  1. [转载]C#读写txt文件的两种方法介绍

    C#读写txt文件的两种方法介绍 by 大龙哥 1.添加命名空间 System.IO; System.Text; 2.文件的读取 (1).使用FileStream类进行文件的读取,并将它转换成char ...

  2. fstream的使用方法介绍

    转载自:  fstream的使用方法介绍 - saga's blog - C++博客 http://www.cppblog.com/saga/archive/2007/06/19/26652.html ...

  3. Windows下获取本机IP地址方法介绍

    Windows下获取本机IP地址方法介绍 if((hostinfo = gethostbyname(name)) != NULL) { #if 1 ; printf("IP COUNT: % ...

  4. WebService服务调用方法介绍

    1 背景概述 由于在项目中需要多次调用webservice服务,本文主要总结了一下java调用WebService常见的6种方式,即:四种框架的五种调用方法以及使用AEAI ESB进行调用的方法. 2 ...

  5. C#读写txt文件的两种方法介绍

    C#读写txt文件的两种方法介绍 1.添加命名空间 System.IO; System.Text; 2.文件的读取 (1).使用FileStream类进行文件的读取,并将它转换成char数组,然后输出 ...

  6. jquery的ajax()函数传值中文乱码解决方法介绍

    jquery的ajax()函数传值中文乱码解决方法介绍,需要的朋友可以参考下 代码如下: $.ajax({ dataType : ‘json', type : ‘POST', url : ‘http: ...

  7. UploadifyAPI-上传插件属性和方法介绍

    上一篇文章简单的介绍了Uploadify上传插件的使用.但是对于常用的属性和方法并没有说明.授人以鱼不如授人以渔,我决定将常用的属性列举出来,供大伙参考参考.           Uploadify属 ...

  8. js保留小数点后N位的方法介绍

    js保留小数点后N位的方法介绍 利用toFixed函数 代码如下 复制代码 <script language="javascript"> document.write( ...

  9. Thinkphp里import的几个使用方法介绍

    以下附上import的几个使用方法介绍 1.使用方法一 import('@.Test.Translate'); @,表示项目根文件夹.假定根文件夹是:App/ 导入类库的路径是:App/Lib/Tes ...

随机推荐

  1. burnside引理&polya定理

    burnside引理&polya定理 参考资料: <polya计数法的应用>--陈瑜希 黄学长 置换: 置换即是将n个元素的染色进行交换,产生一个新的染色方案. 群: 一个元素的集 ...

  2. python 去除字符串两端的引号

    a='"srting"' print(a) b=eval(a) print(b) 输出 "srting" srting

  3. 快递100API接口调用代码示例

    package com.util; import java.io.IOException; import java.io.InputStream; import java.net.MalformedU ...

  4. 【测试设计】性能测试工具选择:wrk?jmeter?locust?还是LR?

    原文链接:http://www.51testing.com/html/49/n-3721249.html 前言 当你想做性能测试的时候,你会选择什么样的测试工具呢?是会选择wrk?jmeter?loc ...

  5. Miller_Rabin(米勒拉宾)素数测试

    2018-03-12 17:22:48 米勒-拉宾素性检验是一种素数判定法则,利用随机化算法判断一个数是合数还是可能是素数.卡内基梅隆大学的计算机系教授Gary Lee Miller首先提出了基于广义 ...

  6. spring boot: 热部署(一) run as – java application (spring-loader-1.2.4.RELEASE.jar)

    spring boot: 热部署(一) run as – java application (spring-loader-1.2.4.RELEASE.jar) 如果使用的run as – java a ...

  7. 雷林鹏分享:JSP 简介

    JSP 简介 什么是Java Server Pages? JSP全称Java Server Pages,是一种动态网页开发技术.它使用JSP标签在HTML网页中插入Java代码.标签通常以<%开 ...

  8. JavaScript学习总结(二十二)——JavaScript屏蔽Backspace键

    今天在IE浏览器下发现,当把使用readonly="readonly"属性将文本框设置成只读<input type="text" readonly=&qu ...

  9. c primer plus 5 读书笔记1

    C语言是一种融合了控制特性的语言,是一种快速.高效.紧凑.可移植性的语言. 使用C语言的7个步骤:定义程序目标.设计程序.编写代码.编译程序.运行程序.测试和调试程序.维护和修改程序. c程序是由一个 ...

  10. 简单地为DBNavigator填加Caption

    http://bbs.2ccc.com/topic.asp?topicid=346735 http://www.cnblogs.com/GarfieldTom/archive/2010/01/18/1 ...