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