appium_lib 0.13.0 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/android_docs.md +0 -1631
- data/docs/ios_docs.md +0 -1697
- data/lib/appium_lib/common/version.rb +1 -1
- data/lib/appium_lib/driver.rb +24 -2
- data/release_notes.md +2 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd077c772b7e083187362e1c528b26fa0409c650
|
4
|
+
data.tar.gz: 3e62c625a2bf5fd2679e8b06c19f61b95c225747
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24de0b1a4b828b8eeb49cde324988f393c130051308708780f2065c3602c63f781a417936f87dca01e6ac64bd56c0e5fa75c09f00320c1237ef2526657a2aea3
|
7
|
+
data.tar.gz: 28194b87d17a5786a14bbee0a80f4afef988149bb8e0b78b8f8c81d83a647d7a52b7f108279947e202594c67e73f834e811adef80168da63868953b55ce81653
|
data/docs/android_docs.md
CHANGED
@@ -1,1631 +0,0 @@
|
|
1
|
-
##### [s_texts](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/element/text.rb#L10)
|
2
|
-
|
3
|
-
> def s_texts text=nil
|
4
|
-
|
5
|
-
Get an array of text texts if text is nil else
|
6
|
-
Get all static textfields that include text.
|
7
|
-
|
8
|
-
__Parameters:__
|
9
|
-
|
10
|
-
[String] text - the text to find.
|
11
|
-
|
12
|
-
__Returns:__
|
13
|
-
|
14
|
-
[Array]
|
15
|
-
|
16
|
-
--
|
17
|
-
|
18
|
-
##### [s_texts_names](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/element/text.rb#L18)
|
19
|
-
|
20
|
-
> def s_texts_names
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
--
|
25
|
-
|
26
|
-
##### [e_s_texts](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/element/text.rb#L24)
|
27
|
-
|
28
|
-
> def e_s_texts
|
29
|
-
|
30
|
-
Get an array of text elements.
|
31
|
-
|
32
|
-
__Returns:__
|
33
|
-
|
34
|
-
[Array<Text>]
|
35
|
-
|
36
|
-
--
|
37
|
-
|
38
|
-
##### [first_s_text](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/element/text.rb#L30)
|
39
|
-
|
40
|
-
> def first_s_text
|
41
|
-
|
42
|
-
Get the first text element.
|
43
|
-
|
44
|
-
__Returns:__
|
45
|
-
|
46
|
-
[Text]
|
47
|
-
|
48
|
-
--
|
49
|
-
|
50
|
-
##### [last_s_text](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/element/text.rb#L36)
|
51
|
-
|
52
|
-
> def last_s_text
|
53
|
-
|
54
|
-
Get the last text element
|
55
|
-
|
56
|
-
__Returns:__
|
57
|
-
|
58
|
-
[Text]
|
59
|
-
|
60
|
-
--
|
61
|
-
|
62
|
-
##### [s_text](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/element/text.rb#L43)
|
63
|
-
|
64
|
-
> def s_text text
|
65
|
-
|
66
|
-
Get the first element that includes text.
|
67
|
-
|
68
|
-
__Parameters:__
|
69
|
-
|
70
|
-
[String, Integer] text - the text to find. If int then the text at that index is returned.
|
71
|
-
|
72
|
-
__Returns:__
|
73
|
-
|
74
|
-
[Text]
|
75
|
-
|
76
|
-
--
|
77
|
-
|
78
|
-
##### [s_text_exact](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/element/text.rb#L51)
|
79
|
-
|
80
|
-
> def s_text_exact text
|
81
|
-
|
82
|
-
Get the first textfield that matches text.
|
83
|
-
|
84
|
-
__Parameters:__
|
85
|
-
|
86
|
-
[String] text - the text that the tag must match
|
87
|
-
|
88
|
-
__Returns:__
|
89
|
-
|
90
|
-
[Text]
|
91
|
-
|
92
|
-
--
|
93
|
-
|
94
|
-
##### [s_texts_exact](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/element/text.rb#L58)
|
95
|
-
|
96
|
-
> def s_texts_exact text
|
97
|
-
|
98
|
-
Get all static textfields that matches text.
|
99
|
-
|
100
|
-
__Parameters:__
|
101
|
-
|
102
|
-
[String] text - the text that the tag must match
|
103
|
-
|
104
|
-
__Returns:__
|
105
|
-
|
106
|
-
[Array<Text>]
|
107
|
-
|
108
|
-
--
|
109
|
-
|
110
|
-
##### [window_size](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/element/window.rb#L5)
|
111
|
-
|
112
|
-
> def window_size
|
113
|
-
|
114
|
-
Get the window's size
|
115
|
-
|
116
|
-
--
|
117
|
-
|
118
|
-
##### [button](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/element/button.rb#L8)
|
119
|
-
|
120
|
-
> def button text, number=0
|
121
|
-
|
122
|
-
Find a button by text and optionally number.
|
123
|
-
|
124
|
-
__Parameters:__
|
125
|
-
|
126
|
-
[String, Integer] text - the text to exactly match. If int then the button at that index is returned.
|
127
|
-
|
128
|
-
[Integer] number - the occurrence of the button matching text. Defaults to the first button.
|
129
|
-
|
130
|
-
__Returns:__
|
131
|
-
|
132
|
-
[Button] the button found with text and matching number
|
133
|
-
|
134
|
-
--
|
135
|
-
|
136
|
-
##### [buttons](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/element/button.rb#L19)
|
137
|
-
|
138
|
-
> def buttons text=nil
|
139
|
-
|
140
|
-
Get an array of button texts or button elements if text is provided.
|
141
|
-
|
142
|
-
__Parameters:__
|
143
|
-
|
144
|
-
[String] text - the text to exactly match
|
145
|
-
|
146
|
-
__Returns:__
|
147
|
-
|
148
|
-
[Array<String>, Array<Buttons>] either an array of button texts or an array of button elements if text is provided.
|
149
|
-
|
150
|
-
--
|
151
|
-
|
152
|
-
##### [first_button](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/element/button.rb#L26)
|
153
|
-
|
154
|
-
> def first_button
|
155
|
-
|
156
|
-
Get the first button element.
|
157
|
-
|
158
|
-
__Returns:__
|
159
|
-
|
160
|
-
[Button]
|
161
|
-
|
162
|
-
--
|
163
|
-
|
164
|
-
##### [last_button](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/element/button.rb#L32)
|
165
|
-
|
166
|
-
> def last_button
|
167
|
-
|
168
|
-
Get the last button element.
|
169
|
-
|
170
|
-
__Returns:__
|
171
|
-
|
172
|
-
[Button]
|
173
|
-
|
174
|
-
--
|
175
|
-
|
176
|
-
##### [button_exact](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/element/button.rb#L39)
|
177
|
-
|
178
|
-
> def button_exact text
|
179
|
-
|
180
|
-
Get the first button element that exactly matches text.
|
181
|
-
|
182
|
-
__Parameters:__
|
183
|
-
|
184
|
-
[String] text - the text to match exactly
|
185
|
-
|
186
|
-
__Returns:__
|
187
|
-
|
188
|
-
[Button]
|
189
|
-
|
190
|
-
--
|
191
|
-
|
192
|
-
##### [buttons_exact](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/element/button.rb#L46)
|
193
|
-
|
194
|
-
> def buttons_exact text
|
195
|
-
|
196
|
-
Get all button elements that exactly match text.
|
197
|
-
|
198
|
-
__Parameters:__
|
199
|
-
|
200
|
-
[String] text - the text to match exactly
|
201
|
-
|
202
|
-
__Returns:__
|
203
|
-
|
204
|
-
[Array<Button>]
|
205
|
-
|
206
|
-
--
|
207
|
-
|
208
|
-
##### [e_buttons](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/element/button.rb#L52)
|
209
|
-
|
210
|
-
> def e_buttons
|
211
|
-
|
212
|
-
Get an array of button elements.
|
213
|
-
|
214
|
-
__Returns:__
|
215
|
-
|
216
|
-
[Array<Button>]
|
217
|
-
|
218
|
-
--
|
219
|
-
|
220
|
-
##### [button_num](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/element/button.rb#L72)
|
221
|
-
|
222
|
-
> def button_num text, number=1
|
223
|
-
|
224
|
-
Expected to be called via button method.
|
225
|
-
|
226
|
-
Get the button element exactly matching text and
|
227
|
-
occurrence. number=2 means the 2nd occurrence.
|
228
|
-
|
229
|
-
find the second Sign In button
|
230
|
-
|
231
|
-
b = e_button 'Sign In', 2
|
232
|
-
|
233
|
-
Button order will change in iOS vs Android
|
234
|
-
so if there's no button found at number then
|
235
|
-
return the first button.
|
236
|
-
|
237
|
-
__Parameters:__
|
238
|
-
|
239
|
-
[String] text - the text to match
|
240
|
-
|
241
|
-
[Integer] number - the button occurance to return. 1 = first button
|
242
|
-
|
243
|
-
__Returns:__
|
244
|
-
|
245
|
-
[Button] the button that matches text and number
|
246
|
-
|
247
|
-
--
|
248
|
-
|
249
|
-
##### [tag_name_to_android](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/android/helper.rb#L6) android
|
250
|
-
|
251
|
-
> def tag_name_to_android tag_name
|
252
|
-
|
253
|
-
Returns an array of android classes that match the tag name
|
254
|
-
|
255
|
-
__Parameters:__
|
256
|
-
|
257
|
-
[String] tag_name - the tag name to convert to an android class
|
258
|
-
|
259
|
-
__Returns:__
|
260
|
-
|
261
|
-
[String]
|
262
|
-
|
263
|
-
--
|
264
|
-
|
265
|
-
##### [find_eles_attr](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/android/helper.rb#L198) android
|
266
|
-
|
267
|
-
> def find_eles_attr tag_name, attribute=nil
|
268
|
-
|
269
|
-
Find all elements matching the attribute
|
270
|
-
On android, assume the attr is name (which falls back to text).
|
271
|
-
|
272
|
-
```ruby
|
273
|
-
find_eles_attr :text
|
274
|
-
```
|
275
|
-
|
276
|
-
__Parameters:__
|
277
|
-
|
278
|
-
[String] tag_name - the tag name to search for
|
279
|
-
|
280
|
-
__Returns:__
|
281
|
-
|
282
|
-
[Element]
|
283
|
-
|
284
|
-
--
|
285
|
-
|
286
|
-
##### [get_selendroid_inspect](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/android/helper.rb#L220) android
|
287
|
-
|
288
|
-
> def get_selendroid_inspect
|
289
|
-
|
290
|
-
Selendroid only.
|
291
|
-
Returns a string containing interesting elements.
|
292
|
-
|
293
|
-
__Returns:__
|
294
|
-
|
295
|
-
[String]
|
296
|
-
|
297
|
-
--
|
298
|
-
|
299
|
-
##### [get_page_class](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/android/helper.rb#L282) android
|
300
|
-
|
301
|
-
> def get_page_class
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
--
|
306
|
-
|
307
|
-
##### [page_class](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/android/helper.rb#L310) android
|
308
|
-
|
309
|
-
> def page_class
|
310
|
-
|
311
|
-
Count all classes on screen and print to stdout.
|
312
|
-
Useful for appium_console.
|
313
|
-
|
314
|
-
--
|
315
|
-
|
316
|
-
##### [get_android_inspect](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/android/helper.rb#L319) android
|
317
|
-
|
318
|
-
> def get_android_inspect
|
319
|
-
|
320
|
-
Android only.
|
321
|
-
Returns a string containing interesting elements.
|
322
|
-
If an element has no content desc or text, then it's not returned by this method.
|
323
|
-
|
324
|
-
__Returns:__
|
325
|
-
|
326
|
-
[String]
|
327
|
-
|
328
|
-
--
|
329
|
-
|
330
|
-
##### [get_inspect](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/android/helper.rb#L403) android
|
331
|
-
|
332
|
-
> def get_inspect
|
333
|
-
|
334
|
-
Automatically detects selendroid or android.
|
335
|
-
Returns a string containing interesting elements.
|
336
|
-
|
337
|
-
__Returns:__
|
338
|
-
|
339
|
-
[String]
|
340
|
-
|
341
|
-
--
|
342
|
-
|
343
|
-
##### [page](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/android/helper.rb#L409) android
|
344
|
-
|
345
|
-
> def page
|
346
|
-
|
347
|
-
Intended for use with console.
|
348
|
-
Inspects and prints the current page.
|
349
|
-
|
350
|
-
--
|
351
|
-
|
352
|
-
##### [fast_duration](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/android/helper.rb#L421) android
|
353
|
-
|
354
|
-
> def fast_duration
|
355
|
-
|
356
|
-
JavaScript code from https://github.com/appium/appium/blob/master/app/android.js
|
357
|
-
|
358
|
-
```javascript
|
359
|
-
Math.round(1.0/28.0 * 28) = 1
|
360
|
-
```
|
361
|
-
|
362
|
-
We want steps to be exactly 1. If it's zero then a tap is used instead of a swipe.
|
363
|
-
|
364
|
-
--
|
365
|
-
|
366
|
-
##### [current_app](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/android/helper.rb#L427) android
|
367
|
-
|
368
|
-
> def current_app
|
369
|
-
|
370
|
-
Lists package, activity, and adb shell am start -n value for current app.
|
371
|
-
Works on local host only (not remote).
|
372
|
-
|
373
|
-
--
|
374
|
-
|
375
|
-
##### [id](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/android/helper.rb#L441) android
|
376
|
-
|
377
|
-
> def id id
|
378
|
-
|
379
|
-
Find by id. Useful for selendroid
|
380
|
-
|
381
|
-
__Parameters:__
|
382
|
-
|
383
|
-
[String] id - the id to search for
|
384
|
-
|
385
|
-
__Returns:__
|
386
|
-
|
387
|
-
[Element]
|
388
|
-
|
389
|
-
--
|
390
|
-
|
391
|
-
##### [alert_click](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/android/element/alert.rb#L6) android
|
392
|
-
|
393
|
-
> def alert_click value
|
394
|
-
|
395
|
-
Tap the alert button identified by value.
|
396
|
-
|
397
|
-
__Parameters:__
|
398
|
-
|
399
|
-
[Integer, String] value - either an integer index of the button or the button's name
|
400
|
-
|
401
|
-
__Returns:__
|
402
|
-
|
403
|
-
[void]
|
404
|
-
|
405
|
-
--
|
406
|
-
|
407
|
-
##### [alert_accept](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/android/element/alert.rb#L13) android
|
408
|
-
|
409
|
-
> def alert_accept
|
410
|
-
|
411
|
-
Accept the alert.
|
412
|
-
The last button is considered "accept."
|
413
|
-
|
414
|
-
__Returns:__
|
415
|
-
|
416
|
-
[void]
|
417
|
-
|
418
|
-
--
|
419
|
-
|
420
|
-
##### [alert_accept_text](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/android/element/alert.rb#L20) android
|
421
|
-
|
422
|
-
> def alert_accept_text
|
423
|
-
|
424
|
-
Get the text of the alert's accept button.
|
425
|
-
The last button is considered "accept."
|
426
|
-
|
427
|
-
__Returns:__
|
428
|
-
|
429
|
-
[String]
|
430
|
-
|
431
|
-
--
|
432
|
-
|
433
|
-
##### [alert_dismiss](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/android/element/alert.rb#L27) android
|
434
|
-
|
435
|
-
> def alert_dismiss
|
436
|
-
|
437
|
-
Dismiss the alert.
|
438
|
-
The first button is considered "dismiss."
|
439
|
-
|
440
|
-
__Returns:__
|
441
|
-
|
442
|
-
[void]
|
443
|
-
|
444
|
-
--
|
445
|
-
|
446
|
-
##### [alert_dismiss_text](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/android/element/alert.rb#L34) android
|
447
|
-
|
448
|
-
> def alert_dismiss_text
|
449
|
-
|
450
|
-
Get the text of the alert's dismiss button.
|
451
|
-
The first button is considered "dismiss."
|
452
|
-
|
453
|
-
__Returns:__
|
454
|
-
|
455
|
-
[String]
|
456
|
-
|
457
|
-
--
|
458
|
-
|
459
|
-
##### [find](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/android/element/generic.rb#L44) android
|
460
|
-
|
461
|
-
> def find val
|
462
|
-
|
463
|
-
Find the value contained in content description or text. Search elements
|
464
|
-
in this order: EditText, Button, ImageButton
|
465
|
-
|
466
|
-
__Parameters:__
|
467
|
-
|
468
|
-
[String] val - the value to search for
|
469
|
-
|
470
|
-
__Returns:__
|
471
|
-
|
472
|
-
[Element]
|
473
|
-
|
474
|
-
--
|
475
|
-
|
476
|
-
##### [text](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/android/element/generic.rb#L70) android
|
477
|
-
|
478
|
-
> def text text
|
479
|
-
|
480
|
-
Return the first element matching text.
|
481
|
-
|
482
|
-
__Parameters:__
|
483
|
-
|
484
|
-
[String] text - the text to search for
|
485
|
-
|
486
|
-
__Returns:__
|
487
|
-
|
488
|
-
[Element] the first matching element
|
489
|
-
|
490
|
-
--
|
491
|
-
|
492
|
-
##### [texts](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/android/element/generic.rb#L79) android
|
493
|
-
|
494
|
-
> def texts text
|
495
|
-
|
496
|
-
Return all elements matching text.
|
497
|
-
|
498
|
-
__Parameters:__
|
499
|
-
|
500
|
-
[String] text - the text to search for
|
501
|
-
|
502
|
-
__Returns:__
|
503
|
-
|
504
|
-
[Array<Element>] all matching elements
|
505
|
-
|
506
|
-
--
|
507
|
-
|
508
|
-
##### [name](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/android/element/generic.rb#L88) android
|
509
|
-
|
510
|
-
> def name name
|
511
|
-
|
512
|
-
Return the first element matching name.
|
513
|
-
on Android name is content description
|
514
|
-
on iOS name is the accessibility label or the text.
|
515
|
-
|
516
|
-
__Parameters:__
|
517
|
-
|
518
|
-
[String] name - the name to search for
|
519
|
-
|
520
|
-
__Returns:__
|
521
|
-
|
522
|
-
[Element] the first matching element
|
523
|
-
|
524
|
-
--
|
525
|
-
|
526
|
-
##### [names](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/android/element/generic.rb#L99) android
|
527
|
-
|
528
|
-
> def names name
|
529
|
-
|
530
|
-
Return all elements matching name.
|
531
|
-
on Android name is content description
|
532
|
-
on iOS name is the accessibility label or the text.
|
533
|
-
|
534
|
-
__Parameters:__
|
535
|
-
|
536
|
-
[String] name - the name to search for
|
537
|
-
|
538
|
-
__Returns:__
|
539
|
-
|
540
|
-
[Array<Element>] all matching elements
|
541
|
-
|
542
|
-
--
|
543
|
-
|
544
|
-
##### [scroll_to](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/android/element/generic.rb#L108) android
|
545
|
-
|
546
|
-
> def scroll_to text
|
547
|
-
|
548
|
-
Scroll to an element containing target text or description.
|
549
|
-
|
550
|
-
__Parameters:__
|
551
|
-
|
552
|
-
[String] text - the text to search for in the text value and content description
|
553
|
-
|
554
|
-
__Returns:__
|
555
|
-
|
556
|
-
[Element] the element scrolled to
|
557
|
-
|
558
|
-
--
|
559
|
-
|
560
|
-
##### [textfields](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/android/element/textfield.rb#L7) android
|
561
|
-
|
562
|
-
> def textfields
|
563
|
-
|
564
|
-
Get an array of textfield texts.
|
565
|
-
|
566
|
-
__Returns:__
|
567
|
-
|
568
|
-
[Array<String>]
|
569
|
-
|
570
|
-
--
|
571
|
-
|
572
|
-
##### [e_textfields](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/android/element/textfield.rb#L13) android
|
573
|
-
|
574
|
-
> def e_textfields
|
575
|
-
|
576
|
-
Get an array of textfield elements.
|
577
|
-
|
578
|
-
__Returns:__
|
579
|
-
|
580
|
-
[Array<Textfield>]
|
581
|
-
|
582
|
-
--
|
583
|
-
|
584
|
-
##### [first_textfield](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/android/element/textfield.rb#L19) android
|
585
|
-
|
586
|
-
> def first_textfield
|
587
|
-
|
588
|
-
Get the first textfield element.
|
589
|
-
|
590
|
-
__Returns:__
|
591
|
-
|
592
|
-
[Textfield]
|
593
|
-
|
594
|
-
--
|
595
|
-
|
596
|
-
##### [last_textfield](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/android/element/textfield.rb#L25) android
|
597
|
-
|
598
|
-
> def last_textfield
|
599
|
-
|
600
|
-
Get the last textfield element.
|
601
|
-
|
602
|
-
__Returns:__
|
603
|
-
|
604
|
-
[Textfield]
|
605
|
-
|
606
|
-
--
|
607
|
-
|
608
|
-
##### [textfield](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/android/element/textfield.rb#L32) android
|
609
|
-
|
610
|
-
> def textfield text
|
611
|
-
|
612
|
-
Get the first textfield that includes text or name (content description).
|
613
|
-
|
614
|
-
__Parameters:__
|
615
|
-
|
616
|
-
[String, Integer] text - the text to search for. If int then the textfield at that index is returned.
|
617
|
-
|
618
|
-
__Returns:__
|
619
|
-
|
620
|
-
[Textfield]
|
621
|
-
|
622
|
-
--
|
623
|
-
|
624
|
-
##### [textfield_exact](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/android/element/textfield.rb#L45) android
|
625
|
-
|
626
|
-
> def textfield_exact text
|
627
|
-
|
628
|
-
Get the first textfield that matches text.
|
629
|
-
|
630
|
-
__Parameters:__
|
631
|
-
|
632
|
-
[String] text - the text to match
|
633
|
-
|
634
|
-
__Returns:__
|
635
|
-
|
636
|
-
[Textfield]
|
637
|
-
|
638
|
-
--
|
639
|
-
|
640
|
-
##### [wait](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/helper.rb#L33)
|
641
|
-
|
642
|
-
> def wait max_wait=-1, interval=0.5, &block
|
643
|
-
|
644
|
-
Check every 0.5 seconds to see if block.call doesn't raise an exception.
|
645
|
-
if .call raises an exception then it will be tried again.
|
646
|
-
if .call doesn't raise an exception then it will stop waiting.
|
647
|
-
|
648
|
-
Example: wait { name('back').click }
|
649
|
-
|
650
|
-
Give up after 30 seconds.
|
651
|
-
|
652
|
-
__Parameters:__
|
653
|
-
|
654
|
-
[Integer] max_wait - the maximum time in seconds to wait for.
|
655
|
-
Note that max wait 0 means infinity.
|
656
|
-
|
657
|
-
[Float] interval - the time in seconds to wait after calling the block
|
658
|
-
|
659
|
-
[Block] block - the block to call
|
660
|
-
|
661
|
-
__Returns:__
|
662
|
-
|
663
|
-
[Object] the result of block.call
|
664
|
-
|
665
|
-
--
|
666
|
-
|
667
|
-
##### [ignore](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/helper.rb#L53)
|
668
|
-
|
669
|
-
> def ignore &block
|
670
|
-
|
671
|
-
Return block.call and ignore any exceptions.
|
672
|
-
|
673
|
-
--
|
674
|
-
|
675
|
-
##### [wait_true](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/helper.rb#L63)
|
676
|
-
|
677
|
-
> def wait_true max_wait=-1, interval=0.5, &block
|
678
|
-
|
679
|
-
Check every 0.5 seconds to see if block.call returns true. nil is considered a failure.
|
680
|
-
Give up after 30 seconds.
|
681
|
-
|
682
|
-
__Parameters:__
|
683
|
-
|
684
|
-
[Integer] max_wait - the maximum time in seconds to wait for
|
685
|
-
|
686
|
-
[Float] interval - the time in seconds to wait after calling the block
|
687
|
-
|
688
|
-
[Block] block - the block to call
|
689
|
-
|
690
|
-
__Returns:__
|
691
|
-
|
692
|
-
[Object] the result of block.call
|
693
|
-
|
694
|
-
--
|
695
|
-
|
696
|
-
##### [back](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/helper.rb#L84)
|
697
|
-
|
698
|
-
> def back
|
699
|
-
|
700
|
-
Navigate back.
|
701
|
-
|
702
|
-
__Returns:__
|
703
|
-
|
704
|
-
[void]
|
705
|
-
|
706
|
-
--
|
707
|
-
|
708
|
-
##### [session_id](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/helper.rb#L89)
|
709
|
-
|
710
|
-
> def session_id
|
711
|
-
|
712
|
-
For Sauce Labs reporting. Returns the current session id.
|
713
|
-
|
714
|
-
--
|
715
|
-
|
716
|
-
##### [xpath](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/helper.rb#L97)
|
717
|
-
|
718
|
-
> def xpath xpath_str
|
719
|
-
|
720
|
-
Returns the first element that matches the provided xpath.
|
721
|
-
|
722
|
-
__Parameters:__
|
723
|
-
|
724
|
-
[String] xpath_str - the XPath string
|
725
|
-
|
726
|
-
__Returns:__
|
727
|
-
|
728
|
-
[Element]
|
729
|
-
|
730
|
-
--
|
731
|
-
|
732
|
-
##### [xpaths](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/helper.rb#L105)
|
733
|
-
|
734
|
-
> def xpaths xpath_str
|
735
|
-
|
736
|
-
Returns all elements that match the provided xpath.
|
737
|
-
|
738
|
-
__Parameters:__
|
739
|
-
|
740
|
-
[String] xpath_str - the XPath string
|
741
|
-
|
742
|
-
__Returns:__
|
743
|
-
|
744
|
-
[Array<Element>]
|
745
|
-
|
746
|
-
--
|
747
|
-
|
748
|
-
##### [ele_index](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/helper.rb#L113)
|
749
|
-
|
750
|
-
> def ele_index tag_name, index
|
751
|
-
|
752
|
-
Get the element of type tag_name at matching index.
|
753
|
-
|
754
|
-
__Parameters:__
|
755
|
-
|
756
|
-
[String] tag_name - the tag name to find
|
757
|
-
|
758
|
-
[Integer] index - the index
|
759
|
-
|
760
|
-
__Returns:__
|
761
|
-
|
762
|
-
[Element] the found element of type tag_name
|
763
|
-
|
764
|
-
--
|
765
|
-
|
766
|
-
##### [find_eles](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/helper.rb#L122)
|
767
|
-
|
768
|
-
> def find_eles tag_name
|
769
|
-
|
770
|
-
Get all elements exactly matching tag name
|
771
|
-
|
772
|
-
__Parameters:__
|
773
|
-
|
774
|
-
[String] tag_name - the tag name to find
|
775
|
-
|
776
|
-
__Returns:__
|
777
|
-
|
778
|
-
[Array<Element>] the found elements of type tag_name
|
779
|
-
|
780
|
-
--
|
781
|
-
|
782
|
-
##### [find_ele_by_text](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/helper.rb#L130)
|
783
|
-
|
784
|
-
> def find_ele_by_text tag, text
|
785
|
-
|
786
|
-
Get the first tag that exactly matches tag and text.
|
787
|
-
|
788
|
-
__Parameters:__
|
789
|
-
|
790
|
-
[String] tag - the tag name to match
|
791
|
-
|
792
|
-
[String] text - the text to exactly match
|
793
|
-
|
794
|
-
__Returns:__
|
795
|
-
|
796
|
-
[Element] the element of type tag exactly matching text
|
797
|
-
|
798
|
-
--
|
799
|
-
|
800
|
-
##### [find_eles_by_text](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/helper.rb#L138)
|
801
|
-
|
802
|
-
> def find_eles_by_text tag, text
|
803
|
-
|
804
|
-
Get all tags that exactly match tag and text.
|
805
|
-
|
806
|
-
__Parameters:__
|
807
|
-
|
808
|
-
[String] tag - the tag name to match
|
809
|
-
|
810
|
-
[String] text - the text to exactly match
|
811
|
-
|
812
|
-
__Returns:__
|
813
|
-
|
814
|
-
[Array<Element>] the elements of type tag exactly matching text
|
815
|
-
|
816
|
-
--
|
817
|
-
|
818
|
-
##### [find_ele_by_attr_include](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/helper.rb#L147)
|
819
|
-
|
820
|
-
> def find_ele_by_attr_include tag, attr, value
|
821
|
-
|
822
|
-
Get the first tag by attribute that exactly matches value.
|
823
|
-
|
824
|
-
__Parameters:__
|
825
|
-
|
826
|
-
[String] tag - the tag name to match
|
827
|
-
|
828
|
-
[String] attr - the attribute to compare
|
829
|
-
|
830
|
-
[String] value - the value of the attribute that the element must include
|
831
|
-
|
832
|
-
__Returns:__
|
833
|
-
|
834
|
-
[Element] the element of type tag who's attribute includes value
|
835
|
-
|
836
|
-
--
|
837
|
-
|
838
|
-
##### [find_eles_by_attr_include](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/helper.rb#L156)
|
839
|
-
|
840
|
-
> def find_eles_by_attr_include tag, attr, value
|
841
|
-
|
842
|
-
Get tags by attribute that include value.
|
843
|
-
|
844
|
-
__Parameters:__
|
845
|
-
|
846
|
-
[String] tag - the tag name to match
|
847
|
-
|
848
|
-
[String] attr - the attribute to compare
|
849
|
-
|
850
|
-
[String] value - the value of the attribute that the element must include
|
851
|
-
|
852
|
-
__Returns:__
|
853
|
-
|
854
|
-
[Array<Element>] the elements of type tag who's attribute includes value
|
855
|
-
|
856
|
-
--
|
857
|
-
|
858
|
-
##### [find_ele_by_text_include](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/helper.rb#L165)
|
859
|
-
|
860
|
-
> def find_ele_by_text_include tag, text
|
861
|
-
|
862
|
-
Get the first tag that includes text.
|
863
|
-
element.attribute(:text).include? text
|
864
|
-
|
865
|
-
__Parameters:__
|
866
|
-
|
867
|
-
[String] tag - the tag name to match
|
868
|
-
|
869
|
-
[String] text - the text the element must include
|
870
|
-
|
871
|
-
__Returns:__
|
872
|
-
|
873
|
-
[Element] the element of type tag that includes text
|
874
|
-
|
875
|
-
--
|
876
|
-
|
877
|
-
##### [find_eles_by_text_include](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/helper.rb#L174)
|
878
|
-
|
879
|
-
> def find_eles_by_text_include tag, text
|
880
|
-
|
881
|
-
Get the tags that include text.
|
882
|
-
element.attribute(:text).include? text
|
883
|
-
|
884
|
-
__Parameters:__
|
885
|
-
|
886
|
-
[String] tag - the tag name to match
|
887
|
-
|
888
|
-
[String] text - the text the element must include
|
889
|
-
|
890
|
-
__Returns:__
|
891
|
-
|
892
|
-
[Array<Element>] the elements of type tag that includes text
|
893
|
-
|
894
|
-
--
|
895
|
-
|
896
|
-
##### [first_ele](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/helper.rb#L181)
|
897
|
-
|
898
|
-
> def first_ele tag_name
|
899
|
-
|
900
|
-
Get the first tag that matches tag_name
|
901
|
-
|
902
|
-
__Parameters:__
|
903
|
-
|
904
|
-
[String] tag_name - the tag to match
|
905
|
-
|
906
|
-
__Returns:__
|
907
|
-
|
908
|
-
[Element]
|
909
|
-
|
910
|
-
--
|
911
|
-
|
912
|
-
##### [last_ele](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/helper.rb#L189)
|
913
|
-
|
914
|
-
> def last_ele tag_name
|
915
|
-
|
916
|
-
Get the last tag that matches tag_name
|
917
|
-
|
918
|
-
__Parameters:__
|
919
|
-
|
920
|
-
[String] tag_name - the tag to match
|
921
|
-
|
922
|
-
__Returns:__
|
923
|
-
|
924
|
-
[Element]
|
925
|
-
|
926
|
-
--
|
927
|
-
|
928
|
-
##### [source](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/helper.rb#L195)
|
929
|
-
|
930
|
-
> def source
|
931
|
-
|
932
|
-
Prints a JSON view of the current page
|
933
|
-
|
934
|
-
__Returns:__
|
935
|
-
|
936
|
-
[void]
|
937
|
-
|
938
|
-
--
|
939
|
-
|
940
|
-
##### [get_source](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/helper.rb#L201)
|
941
|
-
|
942
|
-
> def get_source
|
943
|
-
|
944
|
-
Gets a JSON view of the current page
|
945
|
-
|
946
|
-
__Returns:__
|
947
|
-
|
948
|
-
[JSON]
|
949
|
-
|
950
|
-
--
|
951
|
-
|
952
|
-
##### [find_name](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/helper.rb#L210)
|
953
|
-
|
954
|
-
> def find_name name
|
955
|
-
|
956
|
-
Returns the first element that exactly matches name
|
957
|
-
|
958
|
-
__Parameters:__
|
959
|
-
|
960
|
-
[String] name - the name to exactly match
|
961
|
-
|
962
|
-
__Returns:__
|
963
|
-
|
964
|
-
[Element]
|
965
|
-
|
966
|
-
--
|
967
|
-
|
968
|
-
##### [find_names](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/helper.rb#L218)
|
969
|
-
|
970
|
-
> def find_names name
|
971
|
-
|
972
|
-
Returns all elements that exactly match name
|
973
|
-
|
974
|
-
__Parameters:__
|
975
|
-
|
976
|
-
[String] name - the name to exactly match
|
977
|
-
|
978
|
-
__Returns:__
|
979
|
-
|
980
|
-
[Array<Element>]
|
981
|
-
|
982
|
-
--
|
983
|
-
|
984
|
-
##### [tag](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/helper.rb#L226)
|
985
|
-
|
986
|
-
> def tag tag_name
|
987
|
-
|
988
|
-
Returns the first element matching tag_name
|
989
|
-
|
990
|
-
__Parameters:__
|
991
|
-
|
992
|
-
[String] tag_name - the tag_name to search for
|
993
|
-
|
994
|
-
__Returns:__
|
995
|
-
|
996
|
-
[Element]
|
997
|
-
|
998
|
-
--
|
999
|
-
|
1000
|
-
##### [px_to_window_rel](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/helper.rb#L236)
|
1001
|
-
|
1002
|
-
> def px_to_window_rel opts={}
|
1003
|
-
|
1004
|
-
Converts pixel values to window relative values
|
1005
|
-
|
1006
|
-
```ruby
|
1007
|
-
px_to_window_rel x: 50, y: 150
|
1008
|
-
```
|
1009
|
-
|
1010
|
-
--
|
1011
|
-
|
1012
|
-
##### [lazy_load_strings](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/helper.rb#L246)
|
1013
|
-
|
1014
|
-
> def lazy_load_strings
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
--
|
1019
|
-
|
1020
|
-
##### [xml_keys](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/helper.rb#L253)
|
1021
|
-
|
1022
|
-
> def xml_keys target
|
1023
|
-
|
1024
|
-
Search strings.xml's values for target.
|
1025
|
-
|
1026
|
-
__Parameters:__
|
1027
|
-
|
1028
|
-
[String] target - the target to search for in strings.xml values
|
1029
|
-
|
1030
|
-
__Returns:__
|
1031
|
-
|
1032
|
-
[Array]
|
1033
|
-
|
1034
|
-
--
|
1035
|
-
|
1036
|
-
##### [xml_values](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/helper.rb#L261)
|
1037
|
-
|
1038
|
-
> def xml_values target
|
1039
|
-
|
1040
|
-
Search strings.xml's keys for target.
|
1041
|
-
|
1042
|
-
__Parameters:__
|
1043
|
-
|
1044
|
-
[String] target - the target to search for in strings.xml keys
|
1045
|
-
|
1046
|
-
__Returns:__
|
1047
|
-
|
1048
|
-
[Array]
|
1049
|
-
|
1050
|
-
--
|
1051
|
-
|
1052
|
-
##### [resolve_id](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/helper.rb#L269)
|
1053
|
-
|
1054
|
-
> def resolve_id id
|
1055
|
-
|
1056
|
-
Resolve id in strings.xml and return the value.
|
1057
|
-
|
1058
|
-
__Parameters:__
|
1059
|
-
|
1060
|
-
[String] id - the id to resolve
|
1061
|
-
|
1062
|
-
__Returns:__
|
1063
|
-
|
1064
|
-
[String]
|
1065
|
-
|
1066
|
-
--
|
1067
|
-
|
1068
|
-
##### [raise_no_element_error](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/helper.rb#L275)
|
1069
|
-
|
1070
|
-
> def raise_no_element_error
|
1071
|
-
|
1072
|
-
Used to error when finding a single element fails.
|
1073
|
-
|
1074
|
-
--
|
1075
|
-
|
1076
|
-
##### [value](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/patch.rb#L32)
|
1077
|
-
|
1078
|
-
> def value
|
1079
|
-
|
1080
|
-
Returns the value attribute
|
1081
|
-
|
1082
|
-
Fixes NoMethodError: undefined method `value' for Selenium::WebDriver::Element
|
1083
|
-
|
1084
|
-
--
|
1085
|
-
|
1086
|
-
##### [name](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/patch.rb#L39)
|
1087
|
-
|
1088
|
-
> def name
|
1089
|
-
|
1090
|
-
Returns the name attribute
|
1091
|
-
|
1092
|
-
Fixes NoMethodError: undefined method `name' for Selenium::WebDriver::Element
|
1093
|
-
|
1094
|
-
--
|
1095
|
-
|
1096
|
-
##### [tag_name](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/patch.rb#L46)
|
1097
|
-
|
1098
|
-
> def tag_name
|
1099
|
-
|
1100
|
-
Returns the type attribute
|
1101
|
-
|
1102
|
-
Fixes Selenium::WebDriver::Error::UnknownError: Not yet implemented
|
1103
|
-
|
1104
|
-
--
|
1105
|
-
|
1106
|
-
##### [location_rel](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/common/patch.rb#L58)
|
1107
|
-
|
1108
|
-
> def location_rel
|
1109
|
-
|
1110
|
-
For use with mobile tap.
|
1111
|
-
|
1112
|
-
```ruby
|
1113
|
-
execute_script 'mobile: tap', :x => 0.0, :y => 0.98
|
1114
|
-
```
|
1115
|
-
|
1116
|
-
https://github.com/appium/appium/wiki/Automating-mobile-gestures
|
1117
|
-
|
1118
|
-
__Returns:__
|
1119
|
-
|
1120
|
-
[OpenStruct] the relative x, y in a struct. ex: { x: 0.50, y: 0.20 }
|
1121
|
-
|
1122
|
-
--
|
1123
|
-
|
1124
|
-
##### [CORE](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L16)
|
1125
|
-
|
1126
|
-
> CORE = [ :array, :hash, :class, :file, :dir, :bigdecimal, :rational, :struct, :openstruct, :method, :unboundmethod ]
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
--
|
1131
|
-
|
1132
|
-
##### [awesome_openstruct](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L18)
|
1133
|
-
|
1134
|
-
> def awesome_openstruct target
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
--
|
1139
|
-
|
1140
|
-
##### [load_appium_txt](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L28)
|
1141
|
-
|
1142
|
-
> def load_appium_txt opts
|
1143
|
-
|
1144
|
-
Load appium.txt (toml format) into system ENV
|
1145
|
-
the basedir of this file + appium.txt is what's used
|
1146
|
-
|
1147
|
-
__Parameters:__
|
1148
|
-
|
1149
|
-
[Hash] opts - file: '/path/to/appium.txt', verbose: true
|
1150
|
-
|
1151
|
-
__Returns:__
|
1152
|
-
|
1153
|
-
[Array<String>] the require files. nil if require doesn't exist
|
1154
|
-
|
1155
|
-
--
|
1156
|
-
|
1157
|
-
##### [promote_singleton_appium_methods](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L154)
|
1158
|
-
|
1159
|
-
> def self.promote_singleton_appium_methods main_module
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
--
|
1164
|
-
|
1165
|
-
##### [promote_appium_methods](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L184)
|
1166
|
-
|
1167
|
-
> def self.promote_appium_methods class_array
|
1168
|
-
|
1169
|
-
Promote appium methods to class instance methods
|
1170
|
-
|
1171
|
-
To promote methods to all classes:
|
1172
|
-
|
1173
|
-
```ruby
|
1174
|
-
Appium.promote_appium_methods Object
|
1175
|
-
```
|
1176
|
-
|
1177
|
-
__Parameters:__
|
1178
|
-
|
1179
|
-
[Array<Class>] class_array - An array of classes
|
1180
|
-
|
1181
|
-
--
|
1182
|
-
|
1183
|
-
##### [default_wait](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L515)
|
1184
|
-
|
1185
|
-
> def default_wait
|
1186
|
-
|
1187
|
-
Returns the default client side wait.
|
1188
|
-
This value is independent of what the server is using
|
1189
|
-
|
1190
|
-
__Returns:__
|
1191
|
-
|
1192
|
-
[Integer]
|
1193
|
-
|
1194
|
-
--
|
1195
|
-
|
1196
|
-
##### [app_path](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L213)
|
1197
|
-
|
1198
|
-
> def app_path
|
1199
|
-
|
1200
|
-
Returns the value of attribute app_path
|
1201
|
-
|
1202
|
-
--
|
1203
|
-
|
1204
|
-
##### [app_name](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L213)
|
1205
|
-
|
1206
|
-
> def app_name
|
1207
|
-
|
1208
|
-
Returns the value of attribute app_name
|
1209
|
-
|
1210
|
-
--
|
1211
|
-
|
1212
|
-
##### [device](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L213)
|
1213
|
-
|
1214
|
-
> def device
|
1215
|
-
|
1216
|
-
Returns the value of attribute device
|
1217
|
-
|
1218
|
-
--
|
1219
|
-
|
1220
|
-
##### [app_package](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L213)
|
1221
|
-
|
1222
|
-
> def app_package
|
1223
|
-
|
1224
|
-
Returns the value of attribute app_package
|
1225
|
-
|
1226
|
-
--
|
1227
|
-
|
1228
|
-
##### [app_activity](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L213)
|
1229
|
-
|
1230
|
-
> def app_activity
|
1231
|
-
|
1232
|
-
Returns the value of attribute app_activity
|
1233
|
-
|
1234
|
-
--
|
1235
|
-
|
1236
|
-
##### [app_wait_activity](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L213)
|
1237
|
-
|
1238
|
-
> def app_wait_activity
|
1239
|
-
|
1240
|
-
Returns the value of attribute app_wait_activity
|
1241
|
-
|
1242
|
-
--
|
1243
|
-
|
1244
|
-
##### [sauce_username](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L213)
|
1245
|
-
|
1246
|
-
> def sauce_username
|
1247
|
-
|
1248
|
-
Returns the value of attribute sauce_username
|
1249
|
-
|
1250
|
-
--
|
1251
|
-
|
1252
|
-
##### [sauce_access_key](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L213)
|
1253
|
-
|
1254
|
-
> def sauce_access_key
|
1255
|
-
|
1256
|
-
Returns the value of attribute sauce_access_key
|
1257
|
-
|
1258
|
-
--
|
1259
|
-
|
1260
|
-
##### [port](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L213)
|
1261
|
-
|
1262
|
-
> def port
|
1263
|
-
|
1264
|
-
Returns the value of attribute port
|
1265
|
-
|
1266
|
-
--
|
1267
|
-
|
1268
|
-
##### [debug](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L213)
|
1269
|
-
|
1270
|
-
> def debug
|
1271
|
-
|
1272
|
-
Returns the value of attribute debug
|
1273
|
-
|
1274
|
-
--
|
1275
|
-
|
1276
|
-
##### [export_session](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L213)
|
1277
|
-
|
1278
|
-
> def export_session
|
1279
|
-
|
1280
|
-
Returns the value of attribute export_session
|
1281
|
-
|
1282
|
-
--
|
1283
|
-
|
1284
|
-
##### [device_cap](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L213)
|
1285
|
-
|
1286
|
-
> def device_cap
|
1287
|
-
|
1288
|
-
Returns the value of attribute device_cap
|
1289
|
-
|
1290
|
-
--
|
1291
|
-
|
1292
|
-
##### [compress_xml](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L213)
|
1293
|
-
|
1294
|
-
> def compress_xml
|
1295
|
-
|
1296
|
-
Returns the value of attribute compress_xml
|
1297
|
-
|
1298
|
-
--
|
1299
|
-
|
1300
|
-
##### [custom_url](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L213)
|
1301
|
-
|
1302
|
-
> def custom_url
|
1303
|
-
|
1304
|
-
Returns the value of attribute custom_url
|
1305
|
-
|
1306
|
-
--
|
1307
|
-
|
1308
|
-
##### [global_webdriver_http_sleep](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L219)
|
1309
|
-
|
1310
|
-
> def global_webdriver_http_sleep
|
1311
|
-
|
1312
|
-
The amount to sleep in seconds before every webdriver http call.
|
1313
|
-
|
1314
|
-
--
|
1315
|
-
|
1316
|
-
##### [global_webdriver_http_sleep=](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L219)
|
1317
|
-
|
1318
|
-
> def global_webdriver_http_sleep=(value)
|
1319
|
-
|
1320
|
-
The amount to sleep in seconds before every webdriver http call.
|
1321
|
-
|
1322
|
-
--
|
1323
|
-
|
1324
|
-
##### [initialize](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L249)
|
1325
|
-
|
1326
|
-
> def initialize opts={}
|
1327
|
-
|
1328
|
-
Creates a new driver.
|
1329
|
-
:device is :android, :ios, or :selendroid
|
1330
|
-
|
1331
|
-
```ruby
|
1332
|
-
# Options include:
|
1333
|
-
:app_path, :app_name, :app_package, :app_activity,
|
1334
|
-
:app_wait_activity, :sauce_username, :sauce_access_key,
|
1335
|
-
:port, :os, :debug
|
1336
|
-
|
1337
|
-
require 'rubygems'
|
1338
|
-
require 'appium_lib'
|
1339
|
-
|
1340
|
-
# Start iOS driver
|
1341
|
-
app = { device: :ios, app_path: '/path/to/MyiOS.app'}
|
1342
|
-
Appium::Driver.new(app).start_driver
|
1343
|
-
|
1344
|
-
# Start Android driver
|
1345
|
-
apk = { device: :android
|
1346
|
-
app_path: '/path/to/the.apk',
|
1347
|
-
app_package: 'com.example.pkg',
|
1348
|
-
app_activity: 'act.Start',
|
1349
|
-
app_wait_activity: 'act.Start'
|
1350
|
-
}
|
1351
|
-
|
1352
|
-
Appium::Driver.new(apk).start_driver
|
1353
|
-
```
|
1354
|
-
|
1355
|
-
__Parameters:__
|
1356
|
-
|
1357
|
-
[Object] opts - A hash containing various options.
|
1358
|
-
|
1359
|
-
__Returns:__
|
1360
|
-
|
1361
|
-
[Driver]
|
1362
|
-
|
1363
|
-
--
|
1364
|
-
|
1365
|
-
##### [status](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L356)
|
1366
|
-
|
1367
|
-
> def status
|
1368
|
-
|
1369
|
-
Returns the status payload
|
1370
|
-
|
1371
|
-
```ruby
|
1372
|
-
{"status"=>0,
|
1373
|
-
"value"=>
|
1374
|
-
{"build"=>
|
1375
|
-
{"version"=>"0.8.2",
|
1376
|
-
"revision"=>"f2a2bc3782e4b0370d97a097d7e04913cf008995"}},
|
1377
|
-
"sessionId"=>"8f4b34a7-a9a9-4ac5-b125-36258143446a"}
|
1378
|
-
```
|
1379
|
-
|
1380
|
-
Discover the Appium rev running on the server.
|
1381
|
-
|
1382
|
-
`status["value"]["build"]["revision"]`
|
1383
|
-
`f2a2bc3782e4b0370d97a097d7e04913cf008995`
|
1384
|
-
|
1385
|
-
__Returns:__
|
1386
|
-
|
1387
|
-
[JSON]
|
1388
|
-
|
1389
|
-
--
|
1390
|
-
|
1391
|
-
##### [server_version](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L362)
|
1392
|
-
|
1393
|
-
> def server_version
|
1394
|
-
|
1395
|
-
Returns the server's version string
|
1396
|
-
|
1397
|
-
__Returns:__
|
1398
|
-
|
1399
|
-
[String]
|
1400
|
-
|
1401
|
-
--
|
1402
|
-
|
1403
|
-
##### [absolute_app_path](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L402)
|
1404
|
-
|
1405
|
-
> def absolute_app_path
|
1406
|
-
|
1407
|
-
Converts environment variable APP_PATH to an absolute path.
|
1408
|
-
|
1409
|
-
__Returns:__
|
1410
|
-
|
1411
|
-
[String] APP_PATH as an absolute path
|
1412
|
-
|
1413
|
-
--
|
1414
|
-
|
1415
|
-
##### [server_url](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L422)
|
1416
|
-
|
1417
|
-
> def server_url
|
1418
|
-
|
1419
|
-
Get the server url for sauce or local based on env vars.
|
1420
|
-
|
1421
|
-
__Returns:__
|
1422
|
-
|
1423
|
-
[String] the server url
|
1424
|
-
|
1425
|
-
--
|
1426
|
-
|
1427
|
-
##### [restart](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L433)
|
1428
|
-
|
1429
|
-
> def restart
|
1430
|
-
|
1431
|
-
Restarts the driver
|
1432
|
-
|
1433
|
-
__Returns:__
|
1434
|
-
|
1435
|
-
[Driver] the driver
|
1436
|
-
|
1437
|
-
--
|
1438
|
-
|
1439
|
-
##### [driver](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L440)
|
1440
|
-
|
1441
|
-
> def driver
|
1442
|
-
|
1443
|
-
Returns the driver
|
1444
|
-
|
1445
|
-
__Returns:__
|
1446
|
-
|
1447
|
-
[Driver] the driver
|
1448
|
-
|
1449
|
-
--
|
1450
|
-
|
1451
|
-
##### [screenshot](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L450)
|
1452
|
-
|
1453
|
-
> def screenshot png_save_path
|
1454
|
-
|
1455
|
-
Takes a png screenshot and saves to the target path.
|
1456
|
-
|
1457
|
-
Example: screenshot '/tmp/hi.png'
|
1458
|
-
|
1459
|
-
__Parameters:__
|
1460
|
-
|
1461
|
-
[String] png_save_path - the full path to save the png
|
1462
|
-
|
1463
|
-
__Returns:__
|
1464
|
-
|
1465
|
-
[nil]
|
1466
|
-
|
1467
|
-
--
|
1468
|
-
|
1469
|
-
##### [driver_quit](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L457)
|
1470
|
-
|
1471
|
-
> def driver_quit
|
1472
|
-
|
1473
|
-
Quits the driver
|
1474
|
-
|
1475
|
-
__Returns:__
|
1476
|
-
|
1477
|
-
[void]
|
1478
|
-
|
1479
|
-
--
|
1480
|
-
|
1481
|
-
##### [start_driver](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L465)
|
1482
|
-
|
1483
|
-
> def start_driver
|
1484
|
-
|
1485
|
-
Creates a new global driver and quits the old one if it exists.
|
1486
|
-
|
1487
|
-
__Returns:__
|
1488
|
-
|
1489
|
-
[Selenium::WebDriver] the new global driver
|
1490
|
-
|
1491
|
-
--
|
1492
|
-
|
1493
|
-
##### [no_wait](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L499)
|
1494
|
-
|
1495
|
-
> def no_wait
|
1496
|
-
|
1497
|
-
Set implicit wait and default_wait to zero.
|
1498
|
-
|
1499
|
-
--
|
1500
|
-
|
1501
|
-
##### [set_wait](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L507)
|
1502
|
-
|
1503
|
-
> def set_wait timeout=@default_wait
|
1504
|
-
|
1505
|
-
Set implicit wait and default_wait to timeout, defaults to 30.
|
1506
|
-
|
1507
|
-
__Parameters:__
|
1508
|
-
|
1509
|
-
[Integer] timeout - the timeout in seconds
|
1510
|
-
|
1511
|
-
__Returns:__
|
1512
|
-
|
1513
|
-
[void]
|
1514
|
-
|
1515
|
-
--
|
1516
|
-
|
1517
|
-
##### [exists](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L531)
|
1518
|
-
|
1519
|
-
> def exists pre_check=0, post_check=@default_wait, &search_block
|
1520
|
-
|
1521
|
-
Returns existence of element.
|
1522
|
-
|
1523
|
-
Example:
|
1524
|
-
|
1525
|
-
exists { button('sign in') } ? puts('true') : puts('false')
|
1526
|
-
|
1527
|
-
__Parameters:__
|
1528
|
-
|
1529
|
-
[Integer] pre_check - the amount in seconds to set the
|
1530
|
-
wait to before checking existance
|
1531
|
-
|
1532
|
-
[Integer] post_check - the amount in seconds to set the
|
1533
|
-
wait to after checking existance
|
1534
|
-
|
1535
|
-
[Block] search_block - the block to call
|
1536
|
-
|
1537
|
-
__Returns:__
|
1538
|
-
|
1539
|
-
[Boolean]
|
1540
|
-
|
1541
|
-
--
|
1542
|
-
|
1543
|
-
##### [execute_script](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L553)
|
1544
|
-
|
1545
|
-
> def execute_script script, *args
|
1546
|
-
|
1547
|
-
The same as @driver.execute_script
|
1548
|
-
|
1549
|
-
__Parameters:__
|
1550
|
-
|
1551
|
-
[String] script - the script to execute
|
1552
|
-
|
1553
|
-
[*args] args - the args to pass to the script
|
1554
|
-
|
1555
|
-
__Returns:__
|
1556
|
-
|
1557
|
-
[Object]
|
1558
|
-
|
1559
|
-
--
|
1560
|
-
|
1561
|
-
##### [mobile](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L569)
|
1562
|
-
|
1563
|
-
> def mobile method, *args
|
1564
|
-
|
1565
|
-
Helper method for mobile gestures
|
1566
|
-
|
1567
|
-
https://github.com/appium/appium/wiki/Automating-mobile-gestures
|
1568
|
-
|
1569
|
-
driver.execute_script 'mobile: swipe', endX: 100, endY: 100, duration: 0.01
|
1570
|
-
|
1571
|
-
becomes
|
1572
|
-
|
1573
|
-
mobile :swipe, endX: 100, endY: 100, duration: 0.01
|
1574
|
-
|
1575
|
-
__Parameters:__
|
1576
|
-
|
1577
|
-
[String, Symbol] method - the method to execute
|
1578
|
-
|
1579
|
-
[*args] args - the args to pass to the method
|
1580
|
-
|
1581
|
-
__Returns:__
|
1582
|
-
|
1583
|
-
[Object]
|
1584
|
-
|
1585
|
-
--
|
1586
|
-
|
1587
|
-
##### [find_elements](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L580)
|
1588
|
-
|
1589
|
-
> def find_elements *args
|
1590
|
-
|
1591
|
-
Calls @driver.find_elements
|
1592
|
-
|
1593
|
-
__Parameters:__
|
1594
|
-
|
1595
|
-
[*args] args - the args to use
|
1596
|
-
|
1597
|
-
__Returns:__
|
1598
|
-
|
1599
|
-
[Array<Element>] Array is empty when no elements are found.
|
1600
|
-
|
1601
|
-
--
|
1602
|
-
|
1603
|
-
##### [find_element](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L588)
|
1604
|
-
|
1605
|
-
> def find_element *args
|
1606
|
-
|
1607
|
-
Calls @driver.find_elements
|
1608
|
-
|
1609
|
-
__Parameters:__
|
1610
|
-
|
1611
|
-
[*args] args - the args to use
|
1612
|
-
|
1613
|
-
__Returns:__
|
1614
|
-
|
1615
|
-
[Element]
|
1616
|
-
|
1617
|
-
--
|
1618
|
-
|
1619
|
-
##### [x](https://github.com/appium/ruby_lib/blob/c92bd3710be09731aa8ba4547a3e19af9eeaceab/lib/appium_lib/driver.rb#L595)
|
1620
|
-
|
1621
|
-
> def x
|
1622
|
-
|
1623
|
-
Quit the driver and Pry.
|
1624
|
-
quit and exit are reserved by Pry.
|
1625
|
-
|
1626
|
-
__Returns:__
|
1627
|
-
|
1628
|
-
[void]
|
1629
|
-
|
1630
|
-
--
|
1631
|
-
|