1 page.title=MonkeyRunner
2 parent.title=monkeyrunner
7 h4.jd-details-title {background-color: #DEE8F1;}
10 A monkeyrunner class that contains static utility methods.
13 <table id="pubmethods" class="jd-sumtable">
15 <th colspan="12" style="background-color: #E2E2E2">Methods</th>
18 <td class="jd-typecol">
23 <td class="jd-linkcol" width="100%">
26 <a href="#alert">alert</a>
28 (<em>string</em> message,
29 <em>string</em> title,
30 <em>string</em> okTitle)
32 <div class="jd-descrdiv">
33 Displays an alert dialog to the process running the current
39 <td class="jd-typecol">
44 <td class="jd-linkcol" width="100%">
47 <a href="#choice">choice</a>
49 (<em>string</em> message,
50 <em>iterable</em> choices,
51 <em>string</em> title)
53 <div class="jd-descrdiv">
54 Displays a dialog with a list of choices to the process running the current program.
59 <td class="jd-typecol">
64 <td class="jd-linkcol" width="100%">
67 <a href="#help">help</a>
69 (<em>string</em> format)
71 <div class="jd-descrdiv">
72 Displays the monkeyrunner API reference in a style similar to that of Python's
73 <code>pydoc</code> tool, using the specified format.
78 <td class="jd-typecol">
83 <td class="jd-linkcol" width="100%">
86 <a href="#input">input</a>
88 (<em>string</em> message,
89 <em>string</em> initialValue,
90 <em>string</em> title,
91 <em>string</em> okTitle,
92 <em>string</em> cancelTitle)
94 <div class="jd-descrdiv">
95 Displays a dialog that accepts input.
100 <td class="jd-typecol">
105 <td class="jd-linkcol" width="100%">
107 <span class="sympad">
108 <a href="#sleep">sleep</a>
110 (<em>float</em> seconds)
112 <div class="jd-descrdiv">
113 Pauses the current program for the specified number of seconds.
118 <td class="jd-typecol">
121 <a href="{@docRoot}tools/help/MonkeyDevice.html">MonkeyDevice</a>
125 <td class="jd-linkcol" width="100%">
127 <span class="sympad">
128 <a href="#waitForConnection">waitForConnection</a>
130 (<em>float</em> timeout,
131 <em>string</em> deviceId)
133 <div class="jd-descrdiv">
134 Tries to make a connection between the <code>monkeyrunner</code> backend and the
135 specified device or emulator.
140 <!-- ========= METHOD DETAIL ======== -->
141 <!-- Public methods -->
142 <h2>Public Methods</h2>
144 <div class="jd-details api ">
145 <h4 class="jd-details-title">
146 <span class="normal">
149 <span class="sympad">alert</span>
150 <span class="normal">
152 <em>string</em> message,
153 <em>string</em> title,
154 <em>string</em> okTitle)
157 <div class="jd-details-descr">
159 <div class="jd-tagdata jd-tagdescr">
161 Displays an alert dialog to the process running the current
162 program. The dialog is modal, so the program pauses until the user clicks the dialog's
166 <div class="jd-tagdata">
167 <h5 class="jd-tagtitle">Arguments</h5>
168 <table class="jd-tagtable">
172 The message to display in the dialog.
178 The dialog's title. The default value is "Alert".
184 The text displayed in the dialog button. The default value is "OK".
191 <A NAME="choice"></A>
192 <div class="jd-details api ">
193 <h4 class="jd-details-title">
194 <span class="normal">
197 <span class="sympad">choice</span>
198 <span class="normal">
199 (<em>string</em> message,
200 <em>iterable</em> choices,
201 <em>string</em> title)
204 <div class="jd-details-descr">
206 <div class="jd-tagdata jd-tagdescr">
208 Displays a dialog with a list of choices to the process running the current program. The
209 dialog is modal, so the program pauses until the user clicks one of the dialog's
213 <div class="jd-tagdata">
214 <h5 class="jd-tagtitle">Arguments</h5>
215 <table class="jd-tagtable">
219 The prompt message displayed in the dialog.
225 A Python iterable containing one or more objects that are displayed as strings. The
226 recommended form is an array of strings.
234 The dialog's title. The default is "Input".
239 <div class="jd-tagdata">
240 <h5 class="jd-tagtitle">Returns</h5>
243 If the user makes a selection and clicks the "OK" button, the method returns
244 the 0-based index of the selection within the iterable.
245 If the user clicks the "Cancel" button, the method returns -1.
252 <div class="jd-details api ">
253 <h4 class="jd-details-title">
254 <span class="normal">
257 <span class="sympad">help</span>
258 <span class="normal">
259 (<em>string</em> format)
262 <div class="jd-details-descr">
264 <div class="jd-tagdata jd-tagdescr">
266 Displays the monkeyrunner API reference in a style similar to that of Python's
267 <code>pydoc</code> tool, using the specified format.
270 <div class="jd-tagdata">
271 <h5 class="jd-tagtitle">Arguments</h5>
272 <table class="jd-tagtable">
276 The markup format to use in the output. The possible values are "text" for plain text
285 <div class="jd-details api ">
286 <h4 class="jd-details-title">
287 <span class="normal">
290 <span class="sympad">input</span>
291 <span class="normal">
292 (<em>string</em> message
293 <em>string</em> initialValue,
294 <em>string</em> title,
295 <em>string</em> okTitle,
296 <em>string</em> cancelTitle)
299 <div class="jd-details-descr">
301 <div class="jd-tagdata jd-tagdescr">
303 Displays a dialog that accepts input and returns it to the program. The dialog is
304 modal, so the program pauses until the user clicks one of the dialog's buttons.
307 The dialog contains two buttons, one of which displays the okTitle value
308 and the other the cancelTitle value. If the user clicks the okTitle button,
309 the current value of the input box is returned. If the user clicks the cancelTitle
310 button, an empty string is returned.
313 <div class="jd-tagdata">
314 <h5 class="jd-tagtitle">Arguments</h5>
315 <table class="jd-tagtable">
319 The prompt message displayed in the dialog.
323 <th>initialValue</th>
325 The initial value to display in the dialog. The default is an empty string.
331 The dialog's title. The default is "Input".
337 The text displayed in the okTitle button. The default is "OK".
343 The text displayed in the cancelTitle button. The default is "Cancel".
348 <div class="jd-tagdata">
349 <h5 class="jd-tagtitle">Returns</h5>
352 If the user clicks the okTitle button, then the method returns the current value of
353 the dialog's input box. If the user clicks the cancelTitle button, the method returns
361 <div class="jd-details api ">
362 <h4 class="jd-details-title">
363 <span class="normal">
366 <span class="sympad">sleep</span>
367 <span class="normal">
369 <em>float</em> seconds
373 <div class="jd-details-descr">
375 <div class="jd-tagdata jd-tagdescr">
377 Pauses the current program for the specified number of seconds.
380 <div class="jd-tagdata">
381 <h5 class="jd-tagtitle">Arguments</h5>
382 <table class="jd-tagtable">
386 The number of seconds to pause.
393 <A NAME="waitForConnection"></A>
394 <div class="jd-details api ">
395 <h4 class="jd-details-title">
396 <span class="normal">
398 <a href="{@docRoot}tools/help/MonkeyDevice.html">MonkeyDevice</a>
401 <span class="sympad">waitForConnection</span>
402 <span class="normal">
403 (<em>float</em> timeout,
404 <em>string</em> deviceId)
407 <div class="jd-details-descr">
409 <div class="jd-tagdata jd-tagdescr">
411 Tries to make a connection between the <code>monkeyrunner</code> backend and the
412 specified device or emulator.
415 <div class="jd-tagdata">
416 <h5 class="jd-tagtitle">Arguments</h5>
417 <table class="jd-tagtable">
421 The number of seconds to wait for a connection. The default is to wait forever.
429 A regular expression that specifies the serial number of the device or emulator. See
431 <a href="{@docRoot}tools/help/adb.html">Android Debug Bridge</a>
432 for a description of device and emulator serial numbers.
437 <div class="jd-tagdata">
438 <h5 class="jd-tagtitle">Returns</h5>
441 A <code><a href="{@docRoot}tools/help/MonkeyDevice.html">MonkeyDevice</a></code>
442 instance for the device or emulator. Use this object to control and communicate with the