blob: ea8d69ef7db2f3a919d572f657e8fda8f3827e20 [file] [log] [blame]
Joe Malin9a7eab82010-10-18 17:07:45 -07001page.title=MonkeyRunner
Scott Main9cf2fa02011-02-15 18:26:07 -08002parent.title=monkeyrunner
3parent.link=index.html
Joe Malin9a7eab82010-10-18 17:07:45 -07004@jd:body
Scott Main9cf2fa02011-02-15 18:26:07 -08005
Joe Malin9a7eab82010-10-18 17:07:45 -07006<style>
7 h4.jd-details-title {background-color: #DEE8F1;}
8</style>
9<p>
10 A monkeyrunner class that contains static utility methods.
11</p>
12<h2>Summary</h2>
13<table id="pubmethods" class="jd-sumtable">
14 <tr>
15 <th colspan="12" style="background-color: #E2E2E2">Methods</th>
16 </tr>
17 <tr class="api" >
18 <td class="jd-typecol">
19 <nobr>
20 void
21 </nobr>
22 </td>
23 <td class="jd-linkcol" width="100%">
24 <nobr>
25 <span class="sympad">
26 <a href="#alert">alert</a>
27 </span>
28 (<em>string</em> message,
29 <em>string</em> title,
30 <em>string</em> okTitle)
31 </nobr>
32 <div class="jd-descrdiv">
33 Displays an alert dialog to the process running the current
34 program.
35 </div>
36 </td>
37 </tr>
38 <tr class="api" >
39 <td class="jd-typecol">
40 <nobr>
41 <em>integer</em>
42 </nobr>
43 </td>
44 <td class="jd-linkcol" width="100%">
45 <nobr>
46 <span class="sympad">
47 <a href="#choice">choice</a>
48 </span>
49 (<em>string</em> message,
50 <em>iterable</em> choices,
51 <em>string</em> title)
52 </nobr>
53 <div class="jd-descrdiv">
54 Displays a dialog with a list of choices to the process running the current program.
55 </div>
56 </td>
57 </tr>
58 <tr class="api" >
59 <td class="jd-typecol">
60 <nobr>
61 void
62 </nobr>
63 </td>
64 <td class="jd-linkcol" width="100%">
65 <nobr>
66 <span class="sympad">
67 <a href="#help">help</a>
68 </span>
69 (<em>string</em> format)
70 </nobr>
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.
74 </div>
75 </td>
76 </tr>
77 <tr class="api" >
78 <td class="jd-typecol">
79 <nobr>
80 <em>string</em>
81 </nobr>
82 </td>
83 <td class="jd-linkcol" width="100%">
84 <nobr>
85 <span class="sympad">
86 <a href="#input">input</a>
87 </span>
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)
93 </nobr>
94 <div class="jd-descrdiv">
95 Displays a dialog that accepts input.
96 </div>
97 </td>
98 </tr>
99 <tr class="api" >
100 <td class="jd-typecol">
101 <nobr>
102 void
103 </nobr>
104 </td>
105 <td class="jd-linkcol" width="100%">
106 <nobr>
107 <span class="sympad">
108 <a href="#sleep">sleep</a>
109 </span>
110 (<em>float</em> seconds)
111 </nobr>
112 <div class="jd-descrdiv">
113 Pauses the current program for the specified number of seconds.
114 </div>
115 </td>
116 </tr>
117 <tr class="api" >
118 <td class="jd-typecol">
119 <nobr>
120 <code>
121 <a href="{@docRoot}guide/developing/tools/MonkeyDevice.html">MonkeyDevice</a>
122 </code>
123 </nobr>
124 </td>
125 <td class="jd-linkcol" width="100%">
126 <nobr>
127 <span class="sympad">
128 <a href="#waitForConnection">waitForConnection</a>
129 </span>
130 (<em>float</em> timeout,
131 <em>string</em> deviceId)
132 </nobr>
133 <div class="jd-descrdiv">
134 Tries to make a connection between the <code>monkeyrunner</code> backend and the
135 specified device or emulator.
136 </div>
137 </td>
138 </tr>
139</table>
140<!-- ========= METHOD DETAIL ======== -->
141<!-- Public methods -->
142<h2>Public Methods</h2>
143<A NAME="alert"></A>
144<div class="jd-details api ">
145 <h4 class="jd-details-title">
146 <span class="normal">
147 <em>string</em>
148 </span>
149 <span class="sympad">alert</span>
150 <span class="normal">
151 (
152 <em>string</em> message,
153 <em>string</em> title,
154 <em>string</em> okTitle)
155 </span>
156 </h4>
157 <div class="jd-details-descr">
158
159 <div class="jd-tagdata jd-tagdescr">
160 <p>
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
163 button.
164 </p>
165 </div>
166 <div class="jd-tagdata">
167 <h5 class="jd-tagtitle">Arguments</h5>
168 <table class="jd-tagtable">
169 <tr>
170 <th>message</th>
171 <td>
172 The message to display in the dialog.
173 </td>
174 </tr>
175 <tr>
176 <th>title</th>
177 <td>
178 The dialog's title. The default value is "Alert".
179 </td>
180 </tr>
181 <tr>
182 <th>okTitle</th>
183 <td>
184 The text displayed in the dialog button. The default value is "OK".
185 </td>
186 </tr>
187 </table>
188 </div>
189</div>
190</div>
191<A NAME="choice"></A>
192<div class="jd-details api ">
193 <h4 class="jd-details-title">
194 <span class="normal">
195 <em>integer</em>
196 </span>
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)
202 </span>
203 </h4>
204 <div class="jd-details-descr">
205
206 <div class="jd-tagdata jd-tagdescr">
207 <p>
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
210 buttons.
211 </p>
212 </div>
213 <div class="jd-tagdata">
214 <h5 class="jd-tagtitle">Arguments</h5>
215 <table class="jd-tagtable">
216 <tr>
217 <th>message</th>
218 <td>
219 The prompt message displayed in the dialog.
220 </td>
221 </tr>
222 <tr>
223 <th>choices</th>
224 <td>
225 A Python iterable containing one or more objects that are displayed as strings. The
226 recommended form is an array of strings.
227 </td>
228 </tr>
229 <tr>
230 <th>
231 title
232 </th>
233 <td>
234 The dialog's title. The default is "Input".
235 </td>
236 </tr>
237 </table>
238 </div>
239 <div class="jd-tagdata">
240 <h5 class="jd-tagtitle">Returns</h5>
241 <ul class="nolist">
242 <li>
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.
246 </li>
247 </ul>
248 </div>
249 </div>
250</div>
251<A NAME="help"></A>
252<div class="jd-details api ">
253 <h4 class="jd-details-title">
254 <span class="normal">
255 void
256 </span>
257 <span class="sympad">help</span>
258 <span class="normal">
259 (<em>string</em> format)
260 </span>
261 </h4>
262 <div class="jd-details-descr">
263
264 <div class="jd-tagdata jd-tagdescr">
265 <p>
266 Displays the monkeyrunner API reference in a style similar to that of Python's
267 <code>pydoc</code> tool, using the specified format.
268 </p>
269 </div>
270 <div class="jd-tagdata">
271 <h5 class="jd-tagtitle">Arguments</h5>
272 <table class="jd-tagtable">
273 <tr>
274 <th>format</th>
275 <td>
276 The markup format to use in the output. The possible values are "text" for plain text
277 or "html" for HTML.
278 </td>
279 </tr>
280 </table>
281 </div>
282 </div>
283</div>
284<A NAME="input"></A>
285<div class="jd-details api ">
286 <h4 class="jd-details-title">
287 <span class="normal">
288 <em>string</em>
289 </span>
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)
297 </span>
298 </h4>
299 <div class="jd-details-descr">
300
301 <div class="jd-tagdata jd-tagdescr">
302 <p>
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.
305 </p>
306 <p>
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.
311 </p>
312 </div>
313 <div class="jd-tagdata">
314 <h5 class="jd-tagtitle">Arguments</h5>
315 <table class="jd-tagtable">
316 <tr>
317 <th>message</th>
318 <td>
319 The prompt message displayed in the dialog.
320 </td>
321 </tr>
322 <tr>
323 <th>initialValue</th>
324 <td>
325 The initial value to display in the dialog. The default is an empty string.
326 </td>
327 </tr>
328 <tr>
329 <th>title</th>
330 <td>
331 The dialog's title. The default is "Input".
332 </td>
333 </tr>
334 <tr>
335 <th>okTitle</th>
336 <td>
337 The text displayed in the okTitle button. The default is "OK".
338 </td>
339 </tr>
340 <tr>
341 <th>cancelTitle</th>
342 <td>
343 The text displayed in the cancelTitle button. The default is "Cancel".
344 </td>
345 </tr>
346 </table>
347 </div>
348 <div class="jd-tagdata">
349 <h5 class="jd-tagtitle">Returns</h5>
350 <ul class="nolist">
351 <li>
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
354 an empty string.
355 </li>
356 </ul>
357 </div>
358 </div>
359</div>
360<A NAME="sleep"></A>
361<div class="jd-details api ">
362 <h4 class="jd-details-title">
363 <span class="normal">
364 void
365 </span>
366 <span class="sympad">sleep</span>
367 <span class="normal">
368 (
369 <em>float</em> seconds
370 )
371 </span>
372 </h4>
373 <div class="jd-details-descr">
374
375 <div class="jd-tagdata jd-tagdescr">
376 <p>
377 Pauses the current program for the specified number of seconds.
378 </p>
379 </div>
380 <div class="jd-tagdata">
381 <h5 class="jd-tagtitle">Arguments</h5>
382 <table class="jd-tagtable">
383 <tr>
384 <th>seconds</th>
385 <td>
386 The number of seconds to pause.
387 </td>
388 </tr>
389 </table>
390 </div>
391 </div>
392</div>
393<A NAME="waitForConnection"></A>
394<div class="jd-details api ">
395 <h4 class="jd-details-title">
396 <span class="normal">
397 <code>
398 <a href="{@docRoot}guide/developing/tools/MonkeyDevice.html">MonkeyDevice</a>
399 </code>
400 </span>
401 <span class="sympad">waitForConnection</span>
402 <span class="normal">
403 (<em>float</em> timeout,
404 <em>string</em> deviceId)
405 </span>
406 </h4>
407 <div class="jd-details-descr">
408
409 <div class="jd-tagdata jd-tagdescr">
410 <p>
411 Tries to make a connection between the <code>monkeyrunner</code> backend and the
412 specified device or emulator.
413 </p>
414 </div>
415 <div class="jd-tagdata">
416 <h5 class="jd-tagtitle">Arguments</h5>
417 <table class="jd-tagtable">
418 <tr>
419 <th>timeout</th>
420 <td>
421 The number of seconds to wait for a connection. The default is to wait forever.
422 </td>
423 </tr>
424 <tr>
425 <th>
426 deviceId
427 </th>
428 <td>
429 A regular expression that specifies the serial number of the device or emulator. See
430 the topic
431 <a href="{@docRoot}guide/developing/tools/adb.html">Android Debug Bridge</a>
432 for a description of device and emulator serial numbers.
433 </td>
434 </tr>
435 </table>
436 </div>
437 <div class="jd-tagdata">
438 <h5 class="jd-tagtitle">Returns</h5>
439 <ul class="nolist">
440 <li>
441 A <code><a href="{@docRoot}guide/developing/tools/MonkeyDevice.html">MonkeyDevice</a></code>
442 instance for the device or emulator. Use this object to control and communicate with the
443 device or emulator.
444 </li>
445 </ul>
446 </div>
447 </div>
448</div>