appium_lib 0.15.0 → 0.15.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fc0fd27db21aecf1da1b2885327aee6fab7cc21e
4
- data.tar.gz: 0e541e74c1bd108c6ebc6eff88aeb93ea94adf23
3
+ metadata.gz: 514275236e3eeff9286e061d8fa61567ba3859e6
4
+ data.tar.gz: b94e7206902b8d6ece2e1c3b6be5cc8d24542814
5
5
  SHA512:
6
- metadata.gz: 9d64918287c15449fd1aced0f9759eeb8835ce9d50f57c912c8f58ee9ea8e550ec7d9ee1bcdf0baf141dd709c945768de2ce1881b24416ecd77922c92e5be9cb
7
- data.tar.gz: d2b309aa7f642dac1065a52e55d191ce404300dd81935917e67575b0e6cefe1e3ec710742a1bef5a4181683ccc08f1579c259ab63db02ea653eaab02ce87aabd
6
+ metadata.gz: 87c1f7b6360b5e8665d7a6e4386b080202d12d3449d0714388b053406c9844accebd82f47ea6b49a837815434729b6cb27b610ca2c56fae81b68366b9ed7373b
7
+ data.tar.gz: 0be654ef77534449051e5a8bd04eb69d63bdf4003b768b81b9b1936db0e62c4d8328af5767e92b9b7e3ad1dc28dc885b7024102350b5f0a56aa72168e703320b
data/Gemfile CHANGED
@@ -1,4 +1,2 @@
1
1
  source 'https://rubygems.org'
2
- gemspec
3
-
4
- gem 'yard'
2
+ gemspec
data/Rakefile CHANGED
@@ -1,7 +1,9 @@
1
1
  # encoding: utf-8
2
+ # ruby_lib Rakefile
2
3
  require 'rubygems'
3
4
  require 'rake'
4
5
  require 'date'
6
+ require 'posix/spawn'
5
7
 
6
8
  # Defines gem name.
7
9
  def repo_name; 'appium_lib' end # ruby_lib published as appium_lib
@@ -63,6 +65,11 @@ task :dev do
63
65
  sh 'gem install --no-rdoc --no-ri redcarpet'
64
66
  end
65
67
 
68
+ def tag_exists tag_name
69
+ cmd = %Q(git branch -a --contains "#{tag_name}")
70
+ POSIX::Spawn::Child.new(cmd).out.include? '* master'
71
+ end
72
+
66
73
  # Inspired by Gollum's Rakefile
67
74
  desc 'Build and release a new gem to rubygems.org'
68
75
  task :release => :gem do
@@ -71,16 +78,20 @@ task :release => :gem do
71
78
  exit!
72
79
  end
73
80
 
81
+ # Commit then pull before pushing.
82
+ tag_name = "v#{version}"
83
+ raise 'Tag already exists!' if tag_exists tag_name
84
+
74
85
  # Commit then pull before pushing.
75
86
  sh "git commit --allow-empty -am 'Release #{version}'"
76
87
  sh 'git pull'
77
- sh "git tag v#{version}"
78
- # update notes and docs now that there's a new tag
88
+ sh "git tag #{tag_name}"
89
+ # update notes now that there's a new tag
79
90
  Rake::Task['notes'].execute
80
91
  Rake::Task['docs'].execute
81
92
  sh "git commit --allow-empty -am 'Update release notes'"
82
93
  sh 'git push origin master'
83
- sh "git push origin v#{version}"
94
+ sh "git push origin #{tag_name}"
84
95
  sh "gem push #{repo_name}-#{version}.gem"
85
96
  end
86
97
 
data/appium_lib.gemspec CHANGED
@@ -30,6 +30,8 @@ Gem::Specification.new do |s|
30
30
  s.add_runtime_dependency 'toml', '~> 0.0.4'
31
31
 
32
32
  s.add_development_dependency 'rake', '~> 10.0.4'
33
+ s.add_development_dependency 'yard', '~> 0.8.7.3'
34
+ s.add_development_dependency 'posix/spawn', '~> 0.3.6'
33
35
 
34
36
  s.files = `git ls-files`.split "\n"
35
37
  end
data/docs/android_docs.md CHANGED
@@ -0,0 +1,1690 @@
1
+ ##### [s_texts](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/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/fe6057045fd4d9ee1eb77ec57108755b4d445592/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/fe6057045fd4d9ee1eb77ec57108755b4d445592/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
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Text>]
35
+
36
+ --
37
+
38
+ ##### [first_s_text](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/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
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Text]
47
+
48
+ --
49
+
50
+ ##### [last_s_text](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/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
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Text]
59
+
60
+ --
61
+
62
+ ##### [s_text](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/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
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String, Integer] text - the text to find. If int then the text at that index is returned.
71
+
72
+ __Returns:__
73
+
74
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Text]
75
+
76
+ --
77
+
78
+ ##### [s_text_exact](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/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
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text that the tag must match
87
+
88
+ __Returns:__
89
+
90
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Text]
91
+
92
+ --
93
+
94
+ ##### [s_texts_exact](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/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
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text that the tag must match
103
+
104
+ __Returns:__
105
+
106
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Text>]
107
+
108
+ --
109
+
110
+ ##### [window_size](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/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/fe6057045fd4d9ee1eb77ec57108755b4d445592/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
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String, Integer] text - the text to exactly match. If int then the button at that index is returned.
127
+
128
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Integer] number - the occurrence of the button matching text. Defaults to the first button.
129
+
130
+ __Returns:__
131
+
132
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Button] the button found with text and matching number
133
+
134
+ --
135
+
136
+ ##### [buttons](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/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
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text to exactly match
145
+
146
+ __Returns:__
147
+
148
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[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/fe6057045fd4d9ee1eb77ec57108755b4d445592/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
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Button]
161
+
162
+ --
163
+
164
+ ##### [last_button](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/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
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Button]
173
+
174
+ --
175
+
176
+ ##### [button_exact](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/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
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text to match exactly
185
+
186
+ __Returns:__
187
+
188
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Button]
189
+
190
+ --
191
+
192
+ ##### [buttons_exact](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/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
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text to match exactly
201
+
202
+ __Returns:__
203
+
204
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Button>]
205
+
206
+ --
207
+
208
+ ##### [e_buttons](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/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
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Button>]
217
+
218
+ --
219
+
220
+ ##### [button_num](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/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
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text to match
240
+
241
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Integer] number - the button occurance to return. 1 = first button
242
+
243
+ __Returns:__
244
+
245
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Button] the button that matches text and number
246
+
247
+ --
248
+
249
+ ##### [tag_name_to_android](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/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
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] tag_name - the tag name to convert to an android class
258
+
259
+ __Returns:__
260
+
261
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String]
262
+
263
+ --
264
+
265
+ ##### [find_eles_attr](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/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
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] tag_name - the tag name to search for
279
+
280
+ __Returns:__
281
+
282
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
283
+
284
+ --
285
+
286
+ ##### [get_selendroid_inspect](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/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
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String]
296
+
297
+ --
298
+
299
+ ##### [get_page_class](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/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/fe6057045fd4d9ee1eb77ec57108755b4d445592/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/fe6057045fd4d9ee1eb77ec57108755b4d445592/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
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String]
327
+
328
+ --
329
+
330
+ ##### [get_inspect](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/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
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String]
340
+
341
+ --
342
+
343
+ ##### [page](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/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/fe6057045fd4d9ee1eb77ec57108755b4d445592/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/fe6057045fd4d9ee1eb77ec57108755b4d445592/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/fe6057045fd4d9ee1eb77ec57108755b4d445592/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
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] id - the id to search for
384
+
385
+ __Returns:__
386
+
387
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
388
+
389
+ --
390
+
391
+ ##### [alert_click](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/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
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Integer, String] value - either an integer index of the button or the button's name
400
+
401
+ __Returns:__
402
+
403
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[void]
404
+
405
+ --
406
+
407
+ ##### [alert_accept](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/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
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[void]
417
+
418
+ --
419
+
420
+ ##### [alert_accept_text](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/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
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String]
430
+
431
+ --
432
+
433
+ ##### [alert_dismiss](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/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
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[void]
443
+
444
+ --
445
+
446
+ ##### [alert_dismiss_text](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/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
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String]
456
+
457
+ --
458
+
459
+ ##### [find](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/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
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] val - the value to search for
469
+
470
+ __Returns:__
471
+
472
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
473
+
474
+ --
475
+
476
+ ##### [text](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/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
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text to search for
485
+
486
+ __Returns:__
487
+
488
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element] the first matching element
489
+
490
+ --
491
+
492
+ ##### [texts](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/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
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text to search for
501
+
502
+ __Returns:__
503
+
504
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Element>] all matching elements
505
+
506
+ --
507
+
508
+ ##### [name](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/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
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] name - the name to search for
519
+
520
+ __Returns:__
521
+
522
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element] the first matching element
523
+
524
+ --
525
+
526
+ ##### [name_exact](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/android/element/generic.rb#L99) android
527
+
528
+ > def name_exact name
529
+
530
+ Return the first element exactly 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
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] name - the name to search for
537
+
538
+ __Returns:__
539
+
540
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element] the first matching element
541
+
542
+ --
543
+
544
+ ##### [names](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/android/element/generic.rb#L117) android
545
+
546
+ > def names name=''
547
+
548
+ Return all elements matching name.
549
+ on Android name is content description
550
+ on iOS name is the accessibility label or the text.
551
+
552
+ __Parameters:__
553
+
554
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] name - the name to search for
555
+
556
+ __Returns:__
557
+
558
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Element>] all matching elements
559
+
560
+ --
561
+
562
+ ##### [scroll_to](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/android/element/generic.rb#L131) android
563
+
564
+ > def scroll_to text
565
+
566
+ Scroll to an element containing target text or description.
567
+
568
+ __Parameters:__
569
+
570
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text to search for in the text value and content description
571
+
572
+ __Returns:__
573
+
574
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element] the element scrolled to
575
+
576
+ --
577
+
578
+ ##### [scroll_to_exact](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/android/element/generic.rb#L144) android
579
+
580
+ > def scroll_to_exact text
581
+
582
+ Scroll to an element with the exact target text or description.
583
+
584
+ __Parameters:__
585
+
586
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text to search for in the text value and content description
587
+
588
+ __Returns:__
589
+
590
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element] the element scrolled to
591
+
592
+ --
593
+
594
+ ##### [textfields](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/android/element/textfield.rb#L7) android
595
+
596
+ > def textfields
597
+
598
+ Get an array of textfield texts.
599
+
600
+ __Returns:__
601
+
602
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<String>]
603
+
604
+ --
605
+
606
+ ##### [e_textfields](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/android/element/textfield.rb#L13) android
607
+
608
+ > def e_textfields
609
+
610
+ Get an array of textfield elements.
611
+
612
+ __Returns:__
613
+
614
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Textfield>]
615
+
616
+ --
617
+
618
+ ##### [first_textfield](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/android/element/textfield.rb#L19) android
619
+
620
+ > def first_textfield
621
+
622
+ Get the first textfield element.
623
+
624
+ __Returns:__
625
+
626
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Textfield]
627
+
628
+ --
629
+
630
+ ##### [last_textfield](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/android/element/textfield.rb#L25) android
631
+
632
+ > def last_textfield
633
+
634
+ Get the last textfield element.
635
+
636
+ __Returns:__
637
+
638
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Textfield]
639
+
640
+ --
641
+
642
+ ##### [textfield](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/android/element/textfield.rb#L32) android
643
+
644
+ > def textfield text
645
+
646
+ Get the first textfield that includes text or name (content description).
647
+
648
+ __Parameters:__
649
+
650
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String, Integer] text - the text to search for. If int then the textfield at that index is returned.
651
+
652
+ __Returns:__
653
+
654
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Textfield]
655
+
656
+ --
657
+
658
+ ##### [textfield_exact](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/android/element/textfield.rb#L45) android
659
+
660
+ > def textfield_exact text
661
+
662
+ Get the first textfield that matches text.
663
+
664
+ __Parameters:__
665
+
666
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text to match
667
+
668
+ __Returns:__
669
+
670
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Textfield]
671
+
672
+ --
673
+
674
+ ##### [wait](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/helper.rb#L33)
675
+
676
+ > def wait max_wait=30, interval=0.5, &block
677
+
678
+ Check every 0.5 seconds to see if block.call doesn't raise an exception.
679
+ if .call raises an exception then it will be tried again.
680
+ if .call doesn't raise an exception then it will stop waiting.
681
+
682
+ Example: wait { name('back').click }
683
+
684
+ Give up after 30 seconds.
685
+
686
+ __Parameters:__
687
+
688
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Integer] max_wait - the maximum time in seconds to wait for.
689
+ Note that max wait 0 means infinity.
690
+
691
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Float] interval - the time in seconds to wait after calling the block
692
+
693
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Block] block - the block to call
694
+
695
+ __Returns:__
696
+
697
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Object] the result of block.call
698
+
699
+ --
700
+
701
+ ##### [ignore](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/helper.rb#L45)
702
+
703
+ > def ignore &block
704
+
705
+ Return block.call and ignore any exceptions.
706
+
707
+ --
708
+
709
+ ##### [wait_true](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/helper.rb#L55)
710
+
711
+ > def wait_true max_wait=30, interval=0.5, &block
712
+
713
+ Check every 0.5 seconds to see if block.call returns true. nil is considered a failure.
714
+ Give up after 30 seconds.
715
+
716
+ __Parameters:__
717
+
718
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Integer] max_wait - the maximum time in seconds to wait for
719
+
720
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Float] interval - the time in seconds to wait after calling the block
721
+
722
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Block] block - the block to call
723
+
724
+ __Returns:__
725
+
726
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Object] the result of block.call
727
+
728
+ --
729
+
730
+ ##### [back](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/helper.rb#L68)
731
+
732
+ > def back
733
+
734
+ Navigate back.
735
+
736
+ __Returns:__
737
+
738
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[void]
739
+
740
+ --
741
+
742
+ ##### [session_id](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/helper.rb#L73)
743
+
744
+ > def session_id
745
+
746
+ For Sauce Labs reporting. Returns the current session id.
747
+
748
+ --
749
+
750
+ ##### [xpath](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/helper.rb#L81)
751
+
752
+ > def xpath xpath_str
753
+
754
+ Returns the first element that matches the provided xpath.
755
+
756
+ __Parameters:__
757
+
758
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] xpath_str - the XPath string
759
+
760
+ __Returns:__
761
+
762
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
763
+
764
+ --
765
+
766
+ ##### [xpaths](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/helper.rb#L89)
767
+
768
+ > def xpaths xpath_str
769
+
770
+ Returns all elements that match the provided xpath.
771
+
772
+ __Parameters:__
773
+
774
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] xpath_str - the XPath string
775
+
776
+ __Returns:__
777
+
778
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Element>]
779
+
780
+ --
781
+
782
+ ##### [ele_index](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/helper.rb#L97)
783
+
784
+ > def ele_index tag_name, index
785
+
786
+ Get the element of type tag_name at matching index.
787
+
788
+ __Parameters:__
789
+
790
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] tag_name - the tag name to find
791
+
792
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Integer] index - the index
793
+
794
+ __Returns:__
795
+
796
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element] the found element of type tag_name
797
+
798
+ --
799
+
800
+ ##### [find_eles](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/helper.rb#L106)
801
+
802
+ > def find_eles tag_name
803
+
804
+ Get all elements exactly matching tag name
805
+
806
+ __Parameters:__
807
+
808
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] tag_name - the tag name to find
809
+
810
+ __Returns:__
811
+
812
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Element>] the found elements of type tag_name
813
+
814
+ --
815
+
816
+ ##### [find_ele_by_text](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/helper.rb#L114)
817
+
818
+ > def find_ele_by_text tag, text
819
+
820
+ Get the first tag that exactly matches tag and text.
821
+
822
+ __Parameters:__
823
+
824
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] tag - the tag name to match
825
+
826
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text to exactly match
827
+
828
+ __Returns:__
829
+
830
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element] the element of type tag exactly matching text
831
+
832
+ --
833
+
834
+ ##### [find_eles_by_text](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/helper.rb#L122)
835
+
836
+ > def find_eles_by_text tag, text
837
+
838
+ Get all tags that exactly match tag and text.
839
+
840
+ __Parameters:__
841
+
842
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] tag - the tag name to match
843
+
844
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text to exactly match
845
+
846
+ __Returns:__
847
+
848
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Element>] the elements of type tag exactly matching text
849
+
850
+ --
851
+
852
+ ##### [find_ele_by_attr_include](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/helper.rb#L131)
853
+
854
+ > def find_ele_by_attr_include tag, attr, value
855
+
856
+ Get the first tag by attribute that exactly matches value.
857
+
858
+ __Parameters:__
859
+
860
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] tag - the tag name to match
861
+
862
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] attr - the attribute to compare
863
+
864
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] value - the value of the attribute that the element must include
865
+
866
+ __Returns:__
867
+
868
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element] the element of type tag who's attribute includes value
869
+
870
+ --
871
+
872
+ ##### [find_eles_by_attr_include](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/helper.rb#L140)
873
+
874
+ > def find_eles_by_attr_include tag, attr, value
875
+
876
+ Get tags by attribute that include value.
877
+
878
+ __Parameters:__
879
+
880
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] tag - the tag name to match
881
+
882
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] attr - the attribute to compare
883
+
884
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] value - the value of the attribute that the element must include
885
+
886
+ __Returns:__
887
+
888
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Element>] the elements of type tag who's attribute includes value
889
+
890
+ --
891
+
892
+ ##### [find_ele_by_text_include](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/helper.rb#L149)
893
+
894
+ > def find_ele_by_text_include tag, text
895
+
896
+ Get the first tag that includes text.
897
+ element.attribute(:text).include? text
898
+
899
+ __Parameters:__
900
+
901
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] tag - the tag name to match
902
+
903
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text the element must include
904
+
905
+ __Returns:__
906
+
907
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element] the element of type tag that includes text
908
+
909
+ --
910
+
911
+ ##### [find_eles_by_text_include](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/helper.rb#L158)
912
+
913
+ > def find_eles_by_text_include tag, text
914
+
915
+ Get the tags that include text.
916
+ element.attribute(:text).include? text
917
+
918
+ __Parameters:__
919
+
920
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] tag - the tag name to match
921
+
922
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text the element must include
923
+
924
+ __Returns:__
925
+
926
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Element>] the elements of type tag that includes text
927
+
928
+ --
929
+
930
+ ##### [first_ele](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/helper.rb#L165)
931
+
932
+ > def first_ele tag_name
933
+
934
+ Get the first tag that matches tag_name
935
+
936
+ __Parameters:__
937
+
938
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] tag_name - the tag to match
939
+
940
+ __Returns:__
941
+
942
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
943
+
944
+ --
945
+
946
+ ##### [last_ele](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/helper.rb#L173)
947
+
948
+ > def last_ele tag_name
949
+
950
+ Get the last tag that matches tag_name
951
+
952
+ __Parameters:__
953
+
954
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] tag_name - the tag to match
955
+
956
+ __Returns:__
957
+
958
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
959
+
960
+ --
961
+
962
+ ##### [source](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/helper.rb#L179)
963
+
964
+ > def source
965
+
966
+ Prints a JSON view of the current page
967
+
968
+ __Returns:__
969
+
970
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[void]
971
+
972
+ --
973
+
974
+ ##### [get_source](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/helper.rb#L185)
975
+
976
+ > def get_source
977
+
978
+ Gets a JSON view of the current page
979
+
980
+ __Returns:__
981
+
982
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[JSON]
983
+
984
+ --
985
+
986
+ ##### [find_name](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/helper.rb#L194)
987
+
988
+ > def find_name name
989
+
990
+ Returns the first element that exactly matches name
991
+
992
+ __Parameters:__
993
+
994
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] name - the name to exactly match
995
+
996
+ __Returns:__
997
+
998
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
999
+
1000
+ --
1001
+
1002
+ ##### [find_names](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/helper.rb#L202)
1003
+
1004
+ > def find_names name
1005
+
1006
+ Returns all elements that exactly match name
1007
+
1008
+ __Parameters:__
1009
+
1010
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] name - the name to exactly match
1011
+
1012
+ __Returns:__
1013
+
1014
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Element>]
1015
+
1016
+ --
1017
+
1018
+ ##### [tag](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/helper.rb#L210)
1019
+
1020
+ > def tag tag_name
1021
+
1022
+ Returns the first element matching tag_name
1023
+
1024
+ __Parameters:__
1025
+
1026
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] tag_name - the tag_name to search for
1027
+
1028
+ __Returns:__
1029
+
1030
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
1031
+
1032
+ --
1033
+
1034
+ ##### [tags](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/helper.rb#L218)
1035
+
1036
+ > def tags tag_name
1037
+
1038
+ Returns all elements matching tag_name
1039
+
1040
+ __Parameters:__
1041
+
1042
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] tag_name - the tag_name to search for
1043
+
1044
+ __Returns:__
1045
+
1046
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
1047
+
1048
+ --
1049
+
1050
+ ##### [px_to_window_rel](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/helper.rb#L228)
1051
+
1052
+ > def px_to_window_rel opts={}
1053
+
1054
+ Converts pixel values to window relative values
1055
+
1056
+ ```ruby
1057
+ px_to_window_rel x: 50, y: 150
1058
+ ```
1059
+
1060
+ --
1061
+
1062
+ ##### [lazy_load_strings](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/helper.rb#L238)
1063
+
1064
+ > def lazy_load_strings
1065
+
1066
+
1067
+
1068
+ --
1069
+
1070
+ ##### [xml_keys](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/helper.rb#L245)
1071
+
1072
+ > def xml_keys target
1073
+
1074
+ Search strings.xml's values for target.
1075
+
1076
+ __Parameters:__
1077
+
1078
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] target - the target to search for in strings.xml values
1079
+
1080
+ __Returns:__
1081
+
1082
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array]
1083
+
1084
+ --
1085
+
1086
+ ##### [xml_values](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/helper.rb#L253)
1087
+
1088
+ > def xml_values target
1089
+
1090
+ Search strings.xml's keys for target.
1091
+
1092
+ __Parameters:__
1093
+
1094
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] target - the target to search for in strings.xml keys
1095
+
1096
+ __Returns:__
1097
+
1098
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array]
1099
+
1100
+ --
1101
+
1102
+ ##### [resolve_id](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/helper.rb#L261)
1103
+
1104
+ > def resolve_id id
1105
+
1106
+ Resolve id in strings.xml and return the value.
1107
+
1108
+ __Parameters:__
1109
+
1110
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] id - the id to resolve
1111
+
1112
+ __Returns:__
1113
+
1114
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String]
1115
+
1116
+ --
1117
+
1118
+ ##### [raise_no_element_error](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/helper.rb#L267)
1119
+
1120
+ > def raise_no_element_error
1121
+
1122
+ Used to error when finding a single element fails.
1123
+
1124
+ --
1125
+
1126
+ ##### [value](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/patch.rb#L32)
1127
+
1128
+ > def value
1129
+
1130
+ Returns the value attribute
1131
+
1132
+ Fixes NoMethodError: undefined method `value' for Selenium::WebDriver::Element
1133
+
1134
+ --
1135
+
1136
+ ##### [name](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/patch.rb#L39)
1137
+
1138
+ > def name
1139
+
1140
+ Returns the name attribute
1141
+
1142
+ Fixes NoMethodError: undefined method `name' for Selenium::WebDriver::Element
1143
+
1144
+ --
1145
+
1146
+ ##### [tag_name](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/patch.rb#L46)
1147
+
1148
+ > def tag_name
1149
+
1150
+ Returns the type attribute
1151
+
1152
+ Fixes Selenium::WebDriver::Error::UnknownError: Not yet implemented
1153
+
1154
+ --
1155
+
1156
+ ##### [location_rel](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/common/patch.rb#L58)
1157
+
1158
+ > def location_rel
1159
+
1160
+ For use with mobile tap.
1161
+
1162
+ ```ruby
1163
+ execute_script 'mobile: tap', :x => 0.0, :y => 0.98
1164
+ ```
1165
+
1166
+ https://github.com/appium/appium/wiki/Automating-mobile-gestures
1167
+
1168
+ __Returns:__
1169
+
1170
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[OpenStruct] the relative x, y in a struct. ex: { x: 0.50, y: 0.20 }
1171
+
1172
+ --
1173
+
1174
+ ##### [CORE](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L16)
1175
+
1176
+ > CORE = [ :array, :hash, :class, :file, :dir, :bigdecimal, :rational, :struct, :openstruct, :method, :unboundmethod ]
1177
+
1178
+
1179
+
1180
+ --
1181
+
1182
+ ##### [awesome_openstruct](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L18)
1183
+
1184
+ > def awesome_openstruct target
1185
+
1186
+
1187
+
1188
+ --
1189
+
1190
+ ##### [load_appium_txt](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L28)
1191
+
1192
+ > def load_appium_txt opts
1193
+
1194
+ Load appium.txt (toml format) into system ENV
1195
+ the basedir of this file + appium.txt is what's used
1196
+
1197
+ __Parameters:__
1198
+
1199
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Hash] opts - file: '/path/to/appium.txt', verbose: true
1200
+
1201
+ __Returns:__
1202
+
1203
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<String>] the require files. nil if require doesn't exist
1204
+
1205
+ --
1206
+
1207
+ ##### [promote_singleton_appium_methods](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L154)
1208
+
1209
+ > def self.promote_singleton_appium_methods main_module
1210
+
1211
+
1212
+
1213
+ --
1214
+
1215
+ ##### [promote_appium_methods](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L184)
1216
+
1217
+ > def self.promote_appium_methods class_array
1218
+
1219
+ Promote appium methods to class instance methods
1220
+
1221
+ To promote methods to all classes:
1222
+
1223
+ ```ruby
1224
+ Appium.promote_appium_methods Object
1225
+ ```
1226
+
1227
+ __Parameters:__
1228
+
1229
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Class>] class_array - An array of classes
1230
+
1231
+ --
1232
+
1233
+ ##### [default_wait](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L538)
1234
+
1235
+ > def default_wait
1236
+
1237
+ Returns the default client side wait.
1238
+ This value is independent of what the server is using
1239
+
1240
+ __Returns:__
1241
+
1242
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Integer]
1243
+
1244
+ --
1245
+
1246
+ ##### [app_path](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L213)
1247
+
1248
+ > def app_path
1249
+
1250
+ Returns the value of attribute app_path
1251
+
1252
+ --
1253
+
1254
+ ##### [app_name](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L213)
1255
+
1256
+ > def app_name
1257
+
1258
+ Returns the value of attribute app_name
1259
+
1260
+ --
1261
+
1262
+ ##### [device](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L213)
1263
+
1264
+ > def device
1265
+
1266
+ Returns the value of attribute device
1267
+
1268
+ --
1269
+
1270
+ ##### [app_package](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L213)
1271
+
1272
+ > def app_package
1273
+
1274
+ Returns the value of attribute app_package
1275
+
1276
+ --
1277
+
1278
+ ##### [app_activity](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L213)
1279
+
1280
+ > def app_activity
1281
+
1282
+ Returns the value of attribute app_activity
1283
+
1284
+ --
1285
+
1286
+ ##### [app_wait_activity](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L213)
1287
+
1288
+ > def app_wait_activity
1289
+
1290
+ Returns the value of attribute app_wait_activity
1291
+
1292
+ --
1293
+
1294
+ ##### [sauce_username](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L213)
1295
+
1296
+ > def sauce_username
1297
+
1298
+ Returns the value of attribute sauce_username
1299
+
1300
+ --
1301
+
1302
+ ##### [sauce_access_key](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L213)
1303
+
1304
+ > def sauce_access_key
1305
+
1306
+ Returns the value of attribute sauce_access_key
1307
+
1308
+ --
1309
+
1310
+ ##### [port](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L213)
1311
+
1312
+ > def port
1313
+
1314
+ Returns the value of attribute port
1315
+
1316
+ --
1317
+
1318
+ ##### [debug](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L213)
1319
+
1320
+ > def debug
1321
+
1322
+ Returns the value of attribute debug
1323
+
1324
+ --
1325
+
1326
+ ##### [export_session](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L213)
1327
+
1328
+ > def export_session
1329
+
1330
+ Returns the value of attribute export_session
1331
+
1332
+ --
1333
+
1334
+ ##### [device_cap](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L213)
1335
+
1336
+ > def device_cap
1337
+
1338
+ Returns the value of attribute device_cap
1339
+
1340
+ --
1341
+
1342
+ ##### [compress_xml](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L213)
1343
+
1344
+ > def compress_xml
1345
+
1346
+ Returns the value of attribute compress_xml
1347
+
1348
+ --
1349
+
1350
+ ##### [custom_url](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L213)
1351
+
1352
+ > def custom_url
1353
+
1354
+ Returns the value of attribute custom_url
1355
+
1356
+ --
1357
+
1358
+ ##### [global_webdriver_http_sleep](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L219)
1359
+
1360
+ > def global_webdriver_http_sleep
1361
+
1362
+ The amount to sleep in seconds before every webdriver http call.
1363
+
1364
+ --
1365
+
1366
+ ##### [global_webdriver_http_sleep=](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L219)
1367
+
1368
+ > def global_webdriver_http_sleep=(value)
1369
+
1370
+ The amount to sleep in seconds before every webdriver http call.
1371
+
1372
+ --
1373
+
1374
+ ##### [initialize](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L249)
1375
+
1376
+ > def initialize opts={}
1377
+
1378
+ Creates a new driver.
1379
+ :device is :android, :ios, or :selendroid
1380
+
1381
+ ```ruby
1382
+ # Options include:
1383
+ :app_path, :app_name, :app_package, :app_activity,
1384
+ :app_wait_activity, :sauce_username, :sauce_access_key,
1385
+ :port, :os, :debug
1386
+
1387
+ require 'rubygems'
1388
+ require 'appium_lib'
1389
+
1390
+ # Start iOS driver
1391
+ app = { device: :ios, app_path: '/path/to/MyiOS.app'}
1392
+ Appium::Driver.new(app).start_driver
1393
+
1394
+ # Start Android driver
1395
+ apk = { device: :android
1396
+ app_path: '/path/to/the.apk',
1397
+ app_package: 'com.example.pkg',
1398
+ app_activity: 'act.Start',
1399
+ app_wait_activity: 'act.Start'
1400
+ }
1401
+
1402
+ Appium::Driver.new(apk).start_driver
1403
+ ```
1404
+
1405
+ __Parameters:__
1406
+
1407
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Object] opts - A hash containing various options.
1408
+
1409
+ __Returns:__
1410
+
1411
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Driver]
1412
+
1413
+ --
1414
+
1415
+ ##### [status](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L357)
1416
+
1417
+ > def status
1418
+
1419
+ Returns the status payload
1420
+
1421
+ ```ruby
1422
+ {"status"=>0,
1423
+ "value"=>
1424
+ {"build"=>
1425
+ {"version"=>"0.8.2",
1426
+ "revision"=>"f2a2bc3782e4b0370d97a097d7e04913cf008995"}},
1427
+ "sessionId"=>"8f4b34a7-a9a9-4ac5-b125-36258143446a"}
1428
+ ```
1429
+
1430
+ Discover the Appium rev running on the server.
1431
+
1432
+ `status["value"]["build"]["revision"]`
1433
+ `f2a2bc3782e4b0370d97a097d7e04913cf008995`
1434
+
1435
+ __Returns:__
1436
+
1437
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[JSON]
1438
+
1439
+ --
1440
+
1441
+ ##### [server_version](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L363)
1442
+
1443
+ > def server_version
1444
+
1445
+ Returns the server's version string
1446
+
1447
+ __Returns:__
1448
+
1449
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String]
1450
+
1451
+ --
1452
+
1453
+ ##### [absolute_app_path](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L404)
1454
+
1455
+ > def absolute_app_path
1456
+
1457
+ Converts environment variable APP_PATH to an absolute path.
1458
+
1459
+ __Returns:__
1460
+
1461
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] APP_PATH as an absolute path
1462
+
1463
+ --
1464
+
1465
+ ##### [server_url](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L424)
1466
+
1467
+ > def server_url
1468
+
1469
+ Get the server url for sauce or local based on env vars.
1470
+
1471
+ __Returns:__
1472
+
1473
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] the server url
1474
+
1475
+ --
1476
+
1477
+ ##### [restart](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L435)
1478
+
1479
+ > def restart
1480
+
1481
+ Restarts the driver
1482
+
1483
+ __Returns:__
1484
+
1485
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Driver] the driver
1486
+
1487
+ --
1488
+
1489
+ ##### [driver](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L442)
1490
+
1491
+ > def driver
1492
+
1493
+ Returns the driver
1494
+
1495
+ __Returns:__
1496
+
1497
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Driver] the driver
1498
+
1499
+ --
1500
+
1501
+ ##### [screenshot](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L452)
1502
+
1503
+ > def screenshot png_save_path
1504
+
1505
+ Takes a png screenshot and saves to the target path.
1506
+
1507
+ Example: screenshot '/tmp/hi.png'
1508
+
1509
+ __Parameters:__
1510
+
1511
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] png_save_path - the full path to save the png
1512
+
1513
+ __Returns:__
1514
+
1515
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[nil]
1516
+
1517
+ --
1518
+
1519
+ ##### [driver_quit](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L459)
1520
+
1521
+ > def driver_quit
1522
+
1523
+ Quits the driver
1524
+
1525
+ __Returns:__
1526
+
1527
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[void]
1528
+
1529
+ --
1530
+
1531
+ ##### [start_driver](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L467)
1532
+
1533
+ > def start_driver
1534
+
1535
+ Creates a new global driver and quits the old one if it exists.
1536
+
1537
+ __Returns:__
1538
+
1539
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Selenium::WebDriver] the new global driver
1540
+
1541
+ --
1542
+
1543
+ ##### [no_wait](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L501)
1544
+
1545
+ > def no_wait
1546
+
1547
+ Set implicit wait and default_wait to zero.
1548
+
1549
+ --
1550
+
1551
+ ##### [set_wait](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L520)
1552
+
1553
+ > def set_wait timeout=nil
1554
+
1555
+ Set implicit wait and default_wait to timeout, defaults to 30.
1556
+ if set_wait is called without a param then the second to last
1557
+ wait will be used.
1558
+
1559
+ ```ruby`
1560
+ set_wait 2
1561
+ set_wait 3
1562
+ set_wait # 2
1563
+
1564
+ ````
1565
+
1566
+ __Parameters:__
1567
+
1568
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Integer] timeout - the timeout in seconds
1569
+
1570
+ __Returns:__
1571
+
1572
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[void]
1573
+
1574
+ --
1575
+
1576
+ ##### [exists](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L554)
1577
+
1578
+ > def exists pre_check=0, post_check=@default_wait, &search_block
1579
+
1580
+ Returns existence of element.
1581
+
1582
+ Example:
1583
+
1584
+ exists { button('sign in') } ? puts('true') : puts('false')
1585
+
1586
+ __Parameters:__
1587
+
1588
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Integer] pre_check - the amount in seconds to set the
1589
+ wait to before checking existance
1590
+
1591
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Integer] post_check - the amount in seconds to set the
1592
+ wait to after checking existance
1593
+
1594
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Block] search_block - the block to call
1595
+
1596
+ __Returns:__
1597
+
1598
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Boolean]
1599
+
1600
+ --
1601
+
1602
+ ##### [execute_script](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L578)
1603
+
1604
+ > def execute_script script, *args
1605
+
1606
+ The same as @driver.execute_script
1607
+
1608
+ __Parameters:__
1609
+
1610
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] script - the script to execute
1611
+
1612
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[*args] args - the args to pass to the script
1613
+
1614
+ __Returns:__
1615
+
1616
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Object]
1617
+
1618
+ --
1619
+
1620
+ ##### [mobile](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L594)
1621
+
1622
+ > def mobile method, *args
1623
+
1624
+ Helper method for mobile gestures
1625
+
1626
+ https://github.com/appium/appium/wiki/Automating-mobile-gestures
1627
+
1628
+ driver.execute_script 'mobile: swipe', endX: 100, endY: 100, duration: 0.01
1629
+
1630
+ becomes
1631
+
1632
+ mobile :swipe, endX: 100, endY: 100, duration: 0.01
1633
+
1634
+ __Parameters:__
1635
+
1636
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String, Symbol] method - the method to execute
1637
+
1638
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[*args] args - the args to pass to the method
1639
+
1640
+ __Returns:__
1641
+
1642
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Object]
1643
+
1644
+ --
1645
+
1646
+ ##### [find_elements](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L605)
1647
+
1648
+ > def find_elements *args
1649
+
1650
+ Calls @driver.find_elements
1651
+
1652
+ __Parameters:__
1653
+
1654
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[*args] args - the args to use
1655
+
1656
+ __Returns:__
1657
+
1658
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Element>] Array is empty when no elements are found.
1659
+
1660
+ --
1661
+
1662
+ ##### [find_element](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L613)
1663
+
1664
+ > def find_element *args
1665
+
1666
+ Calls @driver.find_elements
1667
+
1668
+ __Parameters:__
1669
+
1670
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[*args] args - the args to use
1671
+
1672
+ __Returns:__
1673
+
1674
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
1675
+
1676
+ --
1677
+
1678
+ ##### [x](https://github.com/appium/ruby_lib/blob/fe6057045fd4d9ee1eb77ec57108755b4d445592/lib/appium_lib/driver.rb#L620)
1679
+
1680
+ > def x
1681
+
1682
+ Quit the driver and Pry.
1683
+ quit and exit are reserved by Pry.
1684
+
1685
+ __Returns:__
1686
+
1687
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[void]
1688
+
1689
+ --
1690
+