首页 > 其他 > 详细

MonkeyRunner Class

时间:2014-05-28 02:28:23      阅读:458      评论:0      收藏:0      [点我收藏+]

A monkeyrunner class that contains static utility methods.

一个包含静态工具方法的类.

Public Methods

string alert ( string message, string title, string okTitle)

  Displays an alert dialog to the process running the current program. The dialog is modal, so the program pauses until the user clicks the dialog‘s button.

   显示一个在当前程序出现的alert对话框, 这是个模式对话框, 所以程序暂停到用户点击对话框上的按钮.(对话框可以分为模式对话框和非模式对话框两种。模式对话框是指用户   只能在当前的窗体中进行操作,在该窗体没有关闭之前不能切换到其他的窗体。非模式对话框是指当前的所操作的窗体可以切换。)

  Arguments

    message     The message to display in the dialog.

            对话框上显示的信息.

    title        The dialog‘s title. The default value is "Alert".

            对话框的标题,默认是Alert.

    okTitle    The text displayed in the dialog button. The default value is "OK".

            对话框按键上的文字,默认的是OK.

integer choice (string message, iterable choices, string title)

  Displays a dialog with a list of choices to the process running the current program. The dialog is modal, so the program pauses until the user clicks one   of the dialog‘s buttons.

  在当先程序上显示一个带有选择列表的对话框. 这是个模式对话框, 所以程序暂停到用户点击对话框上的按钮.

  Arguments

    message     The prompt message displayed in the dialog.

            在对话框上显示的提示信息.

    choices   A Python iterable containing one or more objects that are displayed as strings. The recommended form is an array of strings.

            包含一个或多个对象作为字符串显示的对象的python 迭代器.推荐的格式是字符串数组.

    title        The dialog‘s title. The default is "Input".

            对话框标题,默认是"输入"

  Returns

    If the user makes a selection and clicks the "OK" button, the method returns the 0-based index of the selection within the iterable. If the user clicks     the "Cancel" button, the method returns -1.

    如果用户做了选择并点击了OK按钮,这个方法返回可迭代的所选的基于0的索引.如果用户点击了"cancel"按钮,方法返回-1.

void help (string format)

  Displays the monkeyrunner API reference in a style similar to that of Python‘s pydoc tool, using the specified format.

  显示monkeyrunner API的参考手册,使用指定的格式

  Arguments

    format  The markup format to use in the output. The possible values are "text" for plain text or "html" for HTML.

          在输出中使用的标记格式,可选的值是"text" 输出普通的文本和"html"输出HTML文件.

string input (string message string initialValue, string title, string okTitle, string cancelTitle)

  Displays a dialog that accepts input and returns it to the program. The dialog is modal, so the program pauses until the user clicks one of the dialog‘s    buttons.

  显示一个可接受输入的对话框并返回它给程序. 这是个模式对话框, 所以程序暂停到用户点击对话框上的按钮

  The dialog contains two buttons, one of which displays the okTitle value and the other the cancelTitle value. If the user clicks the okTitle button, the     current value of the input box is returned. If the user clicks the cancelTitle button, an empty string is returned.

  这个对话框包含两个按钮, 一个显示OKTitle另一个显示cancelTile.如果用户点击OKTitle,返回当前的输入框中的值.如果点击cancelTitle按钮,返回一个空字符串.

  Arguments

    message        The prompt message displayed in the dialog.

              对话框中显示的提示信息.

    initialValue    The initial value to display in the dialog. The default is an empty string.

              对话框中显示的初始值,默认的是空字符串.

    title           The dialog‘s title. The default is "Input".

              对话框标题,默认的是"Input".

    okTitle       The text displayed in the okTitle button. The default is "OK".

              在okTitle 上显示的text,默认的是"OK"

    cancelTitle    The text displayed in the cancelTitle button. The default is "Cancel".

              在cancelTitle 上显示的text,默认的是"Cancel"

  Returns

    If the user clicks the okTitle button, then the method returns the current value of the dialog‘s input box. If the user clicks the cancelTitle button, the     method returns an empty string.

    如果用户点击"okTitle"按钮, 之后方法返回输入框中当前的值,如果用户点击"cancelTitle"按钮,方法返回空字符串.

void sleep ( float seconds )

  Pauses the current program for the specified number of seconds.

  暂停当前程序指定的时间(秒).

  Arguments

    seconds      The number of seconds to pause.

            要暂停的时间.

MonkeyDevice waitForConnection (float timeout, string deviceId)

  Tries to make a connection between the monkeyrunner backend and the specified device or emulator.

  试着建立monkeyrunner 后端与指定设备或者模拟器之间的链接.

  Arguments

    timeout      The number of seconds to wait for a connection. The default is to wait forever.

           等待链接的秒数,默认是一直等待.

    deviceId     A regular expression that specifies the serial number of the device or emulator. See the topic Android Debug Bridge for a description of            device and emulator serial numbers.

            一个指定设备或者模拟器的序列号的正则表达式. 看Android Debug Bridge 的关于设备和虚拟机序列号的topic.

    Returns

      A MonkeyDevice instance for the device or emulator. Use this object to control and communicate with the device or emulator.

      一个针对设备或模拟器的monkeydevice的实例.使用这个对象控制和链接设备和模拟器.

MonkeyRunner Class,布布扣,bubuko.com

MonkeyRunner Class

原文:http://www.cnblogs.com/hanxiaocai/p/3753659.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!