MonkeyRunner




    ## 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.




    ##### Arguments


    message The message to display in the dialog.
    title The dialog's title. The default value is "Alert".
    okTitle The text displayed in the dialog button. The default value is "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
    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.

    void help (string format)

    Arguments
    format The markup format to use in the output. The possible values are "text" for plain text or "html" for 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.

    Arguments
    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.

    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 backend and the specified device or emulator.

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