appium_lib 0.3.16 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/Rakefile +17 -1
- data/docs/android_docs.md +1328 -0
- data/{docs.md → docs/docs.md} +2 -1
- data/docs/ios_docs.md +1362 -0
- data/docs_gen/docs_from_js.md +44 -0
- data/docs_gen/make_docs.rb +81 -0
- data/lib/appium_lib.rb +3 -1
- data/lib/appium_lib/android/element/alert.rb +1 -1
- data/lib/appium_lib/android/element/generic.rb +19 -13
- data/lib/appium_lib/android/helper.rb +21 -3
- data/lib/appium_lib/android/patch.rb +1 -0
- data/lib/appium_lib/common/dynamic.rb +44 -0
- data/lib/appium_lib/common/helper.rb +21 -11
- data/lib/appium_lib/common/patch.rb +45 -6
- data/lib/appium_lib/common/version.rb +2 -2
- data/lib/appium_lib/driver.rb +59 -12
- data/lib/appium_lib/ios/element/generic.rb +6 -7
- data/lib/appium_lib/ios/element/textfield.rb +1 -0
- data/lib/appium_lib/ios/helper.rb +14 -4
- data/lib/appium_lib/ios/patch.rb +1 -13
- data/readme.md +3 -1
- data/release_notes.md +35 -151
- metadata +9 -3
data/{docs.md → docs/docs.md}
RENAMED
@@ -104,6 +104,7 @@ e.rel_location
|
|
104
104
|
e.click
|
105
105
|
e.send_keys 'keys to send'
|
106
106
|
e.set_value 'value to set' # ruby_console specific
|
107
|
+
e.displayed? # true or false depending if the element is visible
|
107
108
|
|
108
109
|
# alert example without helper methods
|
109
110
|
alert = $driver.switch_to.alert
|
@@ -230,4 +231,4 @@ at_exit do
|
|
230
231
|
end
|
231
232
|
end
|
232
233
|
end
|
233
|
-
```
|
234
|
+
```
|
data/docs/ios_docs.md
ADDED
@@ -0,0 +1,1362 @@
|
|
1
|
+
##### [app_path](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/driver.rb#L38)
|
2
|
+
|
3
|
+
> def app_path
|
4
|
+
|
5
|
+
Returns the value of attribute app_path
|
6
|
+
|
7
|
+
--
|
8
|
+
|
9
|
+
##### [app_name](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/driver.rb#L38)
|
10
|
+
|
11
|
+
> def app_name
|
12
|
+
|
13
|
+
Returns the value of attribute app_name
|
14
|
+
|
15
|
+
--
|
16
|
+
|
17
|
+
##### [app_package](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/driver.rb#L38)
|
18
|
+
|
19
|
+
> def app_package
|
20
|
+
|
21
|
+
Returns the value of attribute app_package
|
22
|
+
|
23
|
+
--
|
24
|
+
|
25
|
+
##### [app_activity](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/driver.rb#L38)
|
26
|
+
|
27
|
+
> def app_activity
|
28
|
+
|
29
|
+
Returns the value of attribute app_activity
|
30
|
+
|
31
|
+
--
|
32
|
+
|
33
|
+
##### [app_wait_activity](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/driver.rb#L38)
|
34
|
+
|
35
|
+
> def app_wait_activity
|
36
|
+
|
37
|
+
Returns the value of attribute app_wait_activity
|
38
|
+
|
39
|
+
--
|
40
|
+
|
41
|
+
##### [sauce_username](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/driver.rb#L38)
|
42
|
+
|
43
|
+
> def sauce_username
|
44
|
+
|
45
|
+
Returns the value of attribute sauce_username
|
46
|
+
|
47
|
+
--
|
48
|
+
|
49
|
+
##### [sauce_access_key](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/driver.rb#L38)
|
50
|
+
|
51
|
+
> def sauce_access_key
|
52
|
+
|
53
|
+
Returns the value of attribute sauce_access_key
|
54
|
+
|
55
|
+
--
|
56
|
+
|
57
|
+
##### [port](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/driver.rb#L38)
|
58
|
+
|
59
|
+
> def port
|
60
|
+
|
61
|
+
Returns the value of attribute port
|
62
|
+
|
63
|
+
--
|
64
|
+
|
65
|
+
##### [os](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/driver.rb#L38)
|
66
|
+
|
67
|
+
> def os
|
68
|
+
|
69
|
+
Returns the value of attribute os
|
70
|
+
|
71
|
+
--
|
72
|
+
|
73
|
+
##### [debug](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/driver.rb#L38)
|
74
|
+
|
75
|
+
> def debug
|
76
|
+
|
77
|
+
Returns the value of attribute debug
|
78
|
+
|
79
|
+
--
|
80
|
+
|
81
|
+
##### [initialize](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/driver.rb#L68)
|
82
|
+
|
83
|
+
> def initialize options={}
|
84
|
+
|
85
|
+
Creates a new driver.
|
86
|
+
|
87
|
+
```ruby
|
88
|
+
# Options include:
|
89
|
+
:app_path, :app_name, :app_package, :app_activity,
|
90
|
+
:app_wait_activity, :sauce_username, :sauce_access_key,
|
91
|
+
:port, :os, :debug
|
92
|
+
|
93
|
+
require 'rubygems'
|
94
|
+
require 'appium_lib'
|
95
|
+
|
96
|
+
# Start iOS driver
|
97
|
+
app = { app_path: '/path/to/MyiOS.app'}
|
98
|
+
Appium::Driver.new(app).start_driver
|
99
|
+
|
100
|
+
# Start Android driver
|
101
|
+
apk = { app_path: '/path/to/the.apk',
|
102
|
+
app_package: 'com.example.pkg',
|
103
|
+
app_activity: 'act.Start',
|
104
|
+
app_wait_activity: 'act.Start'
|
105
|
+
}
|
106
|
+
|
107
|
+
Appium::Driver.new(apk).start_driver
|
108
|
+
```
|
109
|
+
|
110
|
+
__Parameters:__
|
111
|
+
|
112
|
+
[Object] options - A hash containing various options.
|
113
|
+
|
114
|
+
__Returns:__
|
115
|
+
|
116
|
+
[Driver]
|
117
|
+
|
118
|
+
--
|
119
|
+
|
120
|
+
##### [absolute_app_path](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/driver.rb#L189)
|
121
|
+
|
122
|
+
> def absolute_app_path
|
123
|
+
|
124
|
+
Converts environment variable APP_PATH to an absolute path.
|
125
|
+
|
126
|
+
__Returns:__
|
127
|
+
|
128
|
+
[String] APP_PATH as an absolute path
|
129
|
+
|
130
|
+
--
|
131
|
+
|
132
|
+
##### [server_url](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/driver.rb#L203)
|
133
|
+
|
134
|
+
> def server_url
|
135
|
+
|
136
|
+
Get the server url for sauce or local based on env vars.
|
137
|
+
|
138
|
+
__Returns:__
|
139
|
+
|
140
|
+
[String] the server url
|
141
|
+
|
142
|
+
--
|
143
|
+
|
144
|
+
##### [restart](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/driver.rb#L213)
|
145
|
+
|
146
|
+
> def restart
|
147
|
+
|
148
|
+
Restarts the driver
|
149
|
+
|
150
|
+
__Returns:__
|
151
|
+
|
152
|
+
[Driver] the driver
|
153
|
+
|
154
|
+
--
|
155
|
+
|
156
|
+
##### [driver](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/driver.rb#L220)
|
157
|
+
|
158
|
+
> def driver
|
159
|
+
|
160
|
+
Returns the driver
|
161
|
+
|
162
|
+
__Returns:__
|
163
|
+
|
164
|
+
[Driver] the driver
|
165
|
+
|
166
|
+
--
|
167
|
+
|
168
|
+
##### [screenshot](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/driver.rb#L228)
|
169
|
+
|
170
|
+
> def screenshot png_save_path
|
171
|
+
|
172
|
+
Takes a png screenshot and saves to the target path.
|
173
|
+
|
174
|
+
__Parameters:__
|
175
|
+
|
176
|
+
[String] png_save_path - the full path to save the png
|
177
|
+
|
178
|
+
__Returns:__
|
179
|
+
|
180
|
+
[void]
|
181
|
+
|
182
|
+
--
|
183
|
+
|
184
|
+
##### [driver_quit](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/driver.rb#L234)
|
185
|
+
|
186
|
+
> def driver_quit
|
187
|
+
|
188
|
+
Quits the driver
|
189
|
+
|
190
|
+
__Returns:__
|
191
|
+
|
192
|
+
[void]
|
193
|
+
|
194
|
+
--
|
195
|
+
|
196
|
+
##### [start_driver](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/driver.rb#L243)
|
197
|
+
|
198
|
+
> def start_driver wait=30
|
199
|
+
|
200
|
+
Creates a new global driver and quits the old one if it exists.
|
201
|
+
|
202
|
+
__Parameters:__
|
203
|
+
|
204
|
+
[Integer] wait - seconds to wait before timing out a command. defaults to 30 seconds
|
205
|
+
|
206
|
+
__Returns:__
|
207
|
+
|
208
|
+
[Selenium::WebDriver] the new global driver
|
209
|
+
|
210
|
+
--
|
211
|
+
|
212
|
+
##### [no_wait](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/driver.rb#L269)
|
213
|
+
|
214
|
+
> def no_wait
|
215
|
+
|
216
|
+
Set implicit wait to zero.
|
217
|
+
|
218
|
+
--
|
219
|
+
|
220
|
+
##### [set_wait](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/driver.rb#L276)
|
221
|
+
|
222
|
+
> def set_wait timeout=@default_wait
|
223
|
+
|
224
|
+
Set implicit wait to timeout, defaults to 30.
|
225
|
+
|
226
|
+
__Parameters:__
|
227
|
+
|
228
|
+
[Integer] timeout - the timeout in seconds
|
229
|
+
|
230
|
+
__Returns:__
|
231
|
+
|
232
|
+
[void]
|
233
|
+
|
234
|
+
--
|
235
|
+
|
236
|
+
##### [default_wait](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/driver.rb#L283)
|
237
|
+
|
238
|
+
> def default_wait
|
239
|
+
|
240
|
+
Returns the default client side wait.
|
241
|
+
This value is independent of what the server is using
|
242
|
+
|
243
|
+
__Returns:__
|
244
|
+
|
245
|
+
[Integer]
|
246
|
+
|
247
|
+
--
|
248
|
+
|
249
|
+
##### [exists](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/driver.rb#L295)
|
250
|
+
|
251
|
+
> def exists &search_block
|
252
|
+
|
253
|
+
Returns existence of element.
|
254
|
+
|
255
|
+
Example:
|
256
|
+
|
257
|
+
exists { button('sign in') } ? puts('true') : puts('false')
|
258
|
+
|
259
|
+
__Parameters:__
|
260
|
+
|
261
|
+
[Block] search_block - the block to call
|
262
|
+
|
263
|
+
__Returns:__
|
264
|
+
|
265
|
+
[Boolean]
|
266
|
+
|
267
|
+
--
|
268
|
+
|
269
|
+
##### [execute_script](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/driver.rb#L320)
|
270
|
+
|
271
|
+
> def execute_script script, *args
|
272
|
+
|
273
|
+
The same as @driver.execute_script
|
274
|
+
|
275
|
+
__Parameters:__
|
276
|
+
|
277
|
+
[String] script - the script to execute
|
278
|
+
|
279
|
+
[*args] args - the args to pass to the script
|
280
|
+
|
281
|
+
__Returns:__
|
282
|
+
|
283
|
+
[Object]
|
284
|
+
|
285
|
+
--
|
286
|
+
|
287
|
+
##### [mobile](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/driver.rb#L336)
|
288
|
+
|
289
|
+
> def mobile method, *args
|
290
|
+
|
291
|
+
Helper method for mobile gestures
|
292
|
+
|
293
|
+
https://github.com/appium/appium/wiki/Automating-mobile-gestures
|
294
|
+
|
295
|
+
driver.execute_script 'mobile: swipe', endX: 100, endY: 100, duration: 0.01
|
296
|
+
|
297
|
+
becomes
|
298
|
+
|
299
|
+
mobile :swipe, endX: 100, endY: 100, duration: 0.01
|
300
|
+
|
301
|
+
__Parameters:__
|
302
|
+
|
303
|
+
[String, Symbol] method - the method to execute
|
304
|
+
|
305
|
+
[*args] args - the args to pass to the method
|
306
|
+
|
307
|
+
__Returns:__
|
308
|
+
|
309
|
+
[Object]
|
310
|
+
|
311
|
+
--
|
312
|
+
|
313
|
+
##### [find_elements](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/driver.rb#L347)
|
314
|
+
|
315
|
+
> def find_elements *args
|
316
|
+
|
317
|
+
Calls @driver.find_elements
|
318
|
+
|
319
|
+
__Parameters:__
|
320
|
+
|
321
|
+
[*args] args - the args to use
|
322
|
+
|
323
|
+
__Returns:__
|
324
|
+
|
325
|
+
[Array<Element>] Array is empty when no elements are found.
|
326
|
+
|
327
|
+
--
|
328
|
+
|
329
|
+
##### [find_element](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/driver.rb#L355)
|
330
|
+
|
331
|
+
> def find_element *args
|
332
|
+
|
333
|
+
Calls @driver.find_elements
|
334
|
+
|
335
|
+
__Parameters:__
|
336
|
+
|
337
|
+
[*args] args - the args to use
|
338
|
+
|
339
|
+
__Returns:__
|
340
|
+
|
341
|
+
[Element]
|
342
|
+
|
343
|
+
--
|
344
|
+
|
345
|
+
##### [x](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/driver.rb#L362)
|
346
|
+
|
347
|
+
> def x
|
348
|
+
|
349
|
+
Quit the driver and Pry.
|
350
|
+
quit and exit are reserved by Pry.
|
351
|
+
|
352
|
+
__Returns:__
|
353
|
+
|
354
|
+
[void]
|
355
|
+
|
356
|
+
--
|
357
|
+
|
358
|
+
##### [wait](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/helper.rb#L32)
|
359
|
+
|
360
|
+
> def wait max_wait=30, interval=0.5, &block
|
361
|
+
|
362
|
+
Check every 0.5 seconds to see if block.call doesn't raise an exception.
|
363
|
+
if .call raises an exception then it will be tried again.
|
364
|
+
if .call doesn't raise an exception then it will stop waiting.
|
365
|
+
|
366
|
+
Example: wait { name('back').click }
|
367
|
+
|
368
|
+
Give up after 30 seconds.
|
369
|
+
|
370
|
+
__Parameters:__
|
371
|
+
|
372
|
+
[Integer] max_wait - the maximum time in seconds to wait for
|
373
|
+
|
374
|
+
[Float] interval - the time in seconds to wait after calling the block
|
375
|
+
|
376
|
+
[Block] block - the block to call
|
377
|
+
|
378
|
+
__Returns:__
|
379
|
+
|
380
|
+
[Object] the result of block.call
|
381
|
+
|
382
|
+
--
|
383
|
+
|
384
|
+
##### [wait_true](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/helper.rb#L49)
|
385
|
+
|
386
|
+
> def wait_true max_wait=30, interval=0.5, &block
|
387
|
+
|
388
|
+
Check every 0.5 seconds to see if block.call returns true. nil is considered a failure.
|
389
|
+
Give up after 30 seconds.
|
390
|
+
|
391
|
+
__Parameters:__
|
392
|
+
|
393
|
+
[Integer] max_wait - the maximum time in seconds to wait for
|
394
|
+
|
395
|
+
[Float] interval - the time in seconds to wait after calling the block
|
396
|
+
|
397
|
+
[Block] block - the block to call
|
398
|
+
|
399
|
+
__Returns:__
|
400
|
+
|
401
|
+
[Object] the result of block.call
|
402
|
+
|
403
|
+
--
|
404
|
+
|
405
|
+
##### [id](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/helper.rb#L63)
|
406
|
+
|
407
|
+
> def id id
|
408
|
+
|
409
|
+
Find by id. Useful for selendroid
|
410
|
+
|
411
|
+
__Parameters:__
|
412
|
+
|
413
|
+
[String] id - the id to search for
|
414
|
+
|
415
|
+
__Returns:__
|
416
|
+
|
417
|
+
[Element]
|
418
|
+
|
419
|
+
--
|
420
|
+
|
421
|
+
##### [back](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/helper.rb#L69)
|
422
|
+
|
423
|
+
> def back
|
424
|
+
|
425
|
+
Navigate back.
|
426
|
+
|
427
|
+
__Returns:__
|
428
|
+
|
429
|
+
[void]
|
430
|
+
|
431
|
+
--
|
432
|
+
|
433
|
+
##### [session_id](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/helper.rb#L74)
|
434
|
+
|
435
|
+
> def session_id
|
436
|
+
|
437
|
+
For Sauce Labs reporting. Returns the current session id.
|
438
|
+
|
439
|
+
--
|
440
|
+
|
441
|
+
##### [xpath](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/helper.rb#L82)
|
442
|
+
|
443
|
+
> def xpath xpath_str
|
444
|
+
|
445
|
+
Returns the first element that matches the provided xpath.
|
446
|
+
|
447
|
+
__Parameters:__
|
448
|
+
|
449
|
+
[String] xpath_str - the XPath string
|
450
|
+
|
451
|
+
__Returns:__
|
452
|
+
|
453
|
+
[Element]
|
454
|
+
|
455
|
+
--
|
456
|
+
|
457
|
+
##### [xpaths](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/helper.rb#L90)
|
458
|
+
|
459
|
+
> def xpaths xpath_str
|
460
|
+
|
461
|
+
Returns all elements that match the provided xpath.
|
462
|
+
|
463
|
+
__Parameters:__
|
464
|
+
|
465
|
+
[String] xpath_str - the XPath string
|
466
|
+
|
467
|
+
__Returns:__
|
468
|
+
|
469
|
+
[Array<Element>]
|
470
|
+
|
471
|
+
--
|
472
|
+
|
473
|
+
##### [ele_index](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/helper.rb#L98)
|
474
|
+
|
475
|
+
> def ele_index tag_name, index
|
476
|
+
|
477
|
+
Get the element of type tag_name at matching index.
|
478
|
+
|
479
|
+
__Parameters:__
|
480
|
+
|
481
|
+
[String] tag_name - the tag name to find
|
482
|
+
|
483
|
+
[Integer] index - the index
|
484
|
+
|
485
|
+
__Returns:__
|
486
|
+
|
487
|
+
[Element] the found element of type tag_name
|
488
|
+
|
489
|
+
--
|
490
|
+
|
491
|
+
##### [find_eles](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/helper.rb#L106)
|
492
|
+
|
493
|
+
> def find_eles tag_name
|
494
|
+
|
495
|
+
Get all elements exactly matching tag name
|
496
|
+
|
497
|
+
__Parameters:__
|
498
|
+
|
499
|
+
[String] tag_name - the tag name to find
|
500
|
+
|
501
|
+
__Returns:__
|
502
|
+
|
503
|
+
[Array<Element>] the found elements of type tag_name
|
504
|
+
|
505
|
+
--
|
506
|
+
|
507
|
+
##### [find_ele_by_text](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/helper.rb#L114)
|
508
|
+
|
509
|
+
> def find_ele_by_text tag, text
|
510
|
+
|
511
|
+
Get the first tag that exactly matches tag and text.
|
512
|
+
|
513
|
+
__Parameters:__
|
514
|
+
|
515
|
+
[String] tag - the tag name to match
|
516
|
+
|
517
|
+
[String] text - the text to exactly match
|
518
|
+
|
519
|
+
__Returns:__
|
520
|
+
|
521
|
+
[Element] the element of type tag exactly matching text
|
522
|
+
|
523
|
+
--
|
524
|
+
|
525
|
+
##### [find_eles_by_text](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/helper.rb#L122)
|
526
|
+
|
527
|
+
> def find_eles_by_text tag, text
|
528
|
+
|
529
|
+
Get all tags that exactly match tag and text.
|
530
|
+
|
531
|
+
__Parameters:__
|
532
|
+
|
533
|
+
[String] tag - the tag name to match
|
534
|
+
|
535
|
+
[String] text - the text to exactly match
|
536
|
+
|
537
|
+
__Returns:__
|
538
|
+
|
539
|
+
[Array<Element>] the elements of type tag exactly matching text
|
540
|
+
|
541
|
+
--
|
542
|
+
|
543
|
+
##### [find_ele_by_attr_include](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/helper.rb#L131)
|
544
|
+
|
545
|
+
> def find_ele_by_attr_include tag, attr, value
|
546
|
+
|
547
|
+
Get the first tag by attribute that exactly matches value.
|
548
|
+
|
549
|
+
__Parameters:__
|
550
|
+
|
551
|
+
[String] tag - the tag name to match
|
552
|
+
|
553
|
+
[String] attr - the attribute to compare
|
554
|
+
|
555
|
+
[String] value - the value of the attribute that the element must include
|
556
|
+
|
557
|
+
__Returns:__
|
558
|
+
|
559
|
+
[Element] the element of type tag who's attribute includes value
|
560
|
+
|
561
|
+
--
|
562
|
+
|
563
|
+
##### [find_eles_by_attr_include](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/helper.rb#L140)
|
564
|
+
|
565
|
+
> def find_eles_by_attr_include tag, attr, value
|
566
|
+
|
567
|
+
Get tags by attribute that include value.
|
568
|
+
|
569
|
+
__Parameters:__
|
570
|
+
|
571
|
+
[String] tag - the tag name to match
|
572
|
+
|
573
|
+
[String] attr - the attribute to compare
|
574
|
+
|
575
|
+
[String] value - the value of the attribute that the element must include
|
576
|
+
|
577
|
+
__Returns:__
|
578
|
+
|
579
|
+
[Array<Element>] the elements of type tag who's attribute includes value
|
580
|
+
|
581
|
+
--
|
582
|
+
|
583
|
+
##### [find_ele_by_text_include](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/helper.rb#L149)
|
584
|
+
|
585
|
+
> def find_ele_by_text_include tag, text
|
586
|
+
|
587
|
+
Get the first tag that includes text.
|
588
|
+
element.attribute(:text).include? text
|
589
|
+
|
590
|
+
__Parameters:__
|
591
|
+
|
592
|
+
[String] tag - the tag name to match
|
593
|
+
|
594
|
+
[String] text - the text the element must include
|
595
|
+
|
596
|
+
__Returns:__
|
597
|
+
|
598
|
+
[Element] the element of type tag that includes text
|
599
|
+
|
600
|
+
--
|
601
|
+
|
602
|
+
##### [find_eles_by_text_include](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/helper.rb#L158)
|
603
|
+
|
604
|
+
> def find_eles_by_text_include tag, text
|
605
|
+
|
606
|
+
Get the tags that include text.
|
607
|
+
element.attribute(:text).include? text
|
608
|
+
|
609
|
+
__Parameters:__
|
610
|
+
|
611
|
+
[String] tag - the tag name to match
|
612
|
+
|
613
|
+
[String] text - the text the element must include
|
614
|
+
|
615
|
+
__Returns:__
|
616
|
+
|
617
|
+
[Array<Element>] the elements of type tag that includes text
|
618
|
+
|
619
|
+
--
|
620
|
+
|
621
|
+
##### [first_ele](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/helper.rb#L165)
|
622
|
+
|
623
|
+
> def first_ele tag_name
|
624
|
+
|
625
|
+
Get the first tag that matches tag_name
|
626
|
+
|
627
|
+
__Parameters:__
|
628
|
+
|
629
|
+
[String] tag_name - the tag to match
|
630
|
+
|
631
|
+
__Returns:__
|
632
|
+
|
633
|
+
[Element]
|
634
|
+
|
635
|
+
--
|
636
|
+
|
637
|
+
##### [last_ele](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/helper.rb#L173)
|
638
|
+
|
639
|
+
> def last_ele tag_name
|
640
|
+
|
641
|
+
Get the last tag that matches tag_name
|
642
|
+
|
643
|
+
__Parameters:__
|
644
|
+
|
645
|
+
[String] tag_name - the tag to match
|
646
|
+
|
647
|
+
__Returns:__
|
648
|
+
|
649
|
+
[Element]
|
650
|
+
|
651
|
+
--
|
652
|
+
|
653
|
+
##### [source](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/helper.rb#L179)
|
654
|
+
|
655
|
+
> def source
|
656
|
+
|
657
|
+
Prints a JSON view of the current page
|
658
|
+
|
659
|
+
__Returns:__
|
660
|
+
|
661
|
+
[void]
|
662
|
+
|
663
|
+
--
|
664
|
+
|
665
|
+
##### [get_source](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/helper.rb#L185)
|
666
|
+
|
667
|
+
> def get_source
|
668
|
+
|
669
|
+
Gets a JSON view of the current page
|
670
|
+
|
671
|
+
__Returns:__
|
672
|
+
|
673
|
+
[JSON]
|
674
|
+
|
675
|
+
--
|
676
|
+
|
677
|
+
##### [find_name](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/helper.rb#L194)
|
678
|
+
|
679
|
+
> def find_name name
|
680
|
+
|
681
|
+
Returns the first element that matches name
|
682
|
+
|
683
|
+
__Parameters:__
|
684
|
+
|
685
|
+
[String] name - the name to match
|
686
|
+
|
687
|
+
__Returns:__
|
688
|
+
|
689
|
+
[Element]
|
690
|
+
|
691
|
+
--
|
692
|
+
|
693
|
+
##### [find_names](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/helper.rb#L202)
|
694
|
+
|
695
|
+
> def find_names name
|
696
|
+
|
697
|
+
Returns all elements that match name
|
698
|
+
|
699
|
+
__Parameters:__
|
700
|
+
|
701
|
+
[String] name - the name to match
|
702
|
+
|
703
|
+
__Returns:__
|
704
|
+
|
705
|
+
[Array<Element>]
|
706
|
+
|
707
|
+
--
|
708
|
+
|
709
|
+
##### [dynamic_code_to_string](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/dynamic.rb#L38)
|
710
|
+
|
711
|
+
> def dynamic_code_to_string code, value=false
|
712
|
+
|
713
|
+
|
714
|
+
|
715
|
+
--
|
716
|
+
|
717
|
+
##### [s_texts](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/element/text.rb#L8)
|
718
|
+
|
719
|
+
> def s_texts
|
720
|
+
|
721
|
+
Get an array of text texts.
|
722
|
+
|
723
|
+
__Returns:__
|
724
|
+
|
725
|
+
[Array<String>]
|
726
|
+
|
727
|
+
--
|
728
|
+
|
729
|
+
##### [e_s_texts](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/element/text.rb#L14)
|
730
|
+
|
731
|
+
> def e_s_texts
|
732
|
+
|
733
|
+
Get an array of text elements.
|
734
|
+
|
735
|
+
__Returns:__
|
736
|
+
|
737
|
+
[Array<Text>]
|
738
|
+
|
739
|
+
--
|
740
|
+
|
741
|
+
##### [s_first_text](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/element/text.rb#L20)
|
742
|
+
|
743
|
+
> def s_first_text
|
744
|
+
|
745
|
+
Get the first text element.
|
746
|
+
|
747
|
+
__Returns:__
|
748
|
+
|
749
|
+
[Text]
|
750
|
+
|
751
|
+
--
|
752
|
+
|
753
|
+
##### [s_last_text](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/element/text.rb#L26)
|
754
|
+
|
755
|
+
> def s_last_text
|
756
|
+
|
757
|
+
Get the last text element
|
758
|
+
|
759
|
+
__Returns:__
|
760
|
+
|
761
|
+
[Text]
|
762
|
+
|
763
|
+
--
|
764
|
+
|
765
|
+
##### [s_text](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/element/text.rb#L33)
|
766
|
+
|
767
|
+
> def s_text text
|
768
|
+
|
769
|
+
Get the first element that includes text.
|
770
|
+
|
771
|
+
__Parameters:__
|
772
|
+
|
773
|
+
[String, Integer] text - the text to find. If int then the text at that index is returned.
|
774
|
+
|
775
|
+
__Returns:__
|
776
|
+
|
777
|
+
[Text]
|
778
|
+
|
779
|
+
--
|
780
|
+
|
781
|
+
##### [s_text_exact](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/element/text.rb#L41)
|
782
|
+
|
783
|
+
> def s_text_exact text
|
784
|
+
|
785
|
+
Get the first textfield that matches text.
|
786
|
+
|
787
|
+
__Parameters:__
|
788
|
+
|
789
|
+
[String] text - the text that the tag must match
|
790
|
+
|
791
|
+
__Returns:__
|
792
|
+
|
793
|
+
[Text]
|
794
|
+
|
795
|
+
--
|
796
|
+
|
797
|
+
##### [button](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/element/button.rb#L8)
|
798
|
+
|
799
|
+
> def button text, number=0
|
800
|
+
|
801
|
+
Find a button by text and optionally number.
|
802
|
+
|
803
|
+
__Parameters:__
|
804
|
+
|
805
|
+
[String, Integer] text - the text to exactly match. If int then the button at that index is returned.
|
806
|
+
|
807
|
+
[Integer] number - the occurrence of the button matching text. Defaults to the first button.
|
808
|
+
|
809
|
+
__Returns:__
|
810
|
+
|
811
|
+
[Button] the button found with text and matching number
|
812
|
+
|
813
|
+
--
|
814
|
+
|
815
|
+
##### [buttons](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/element/button.rb#L19)
|
816
|
+
|
817
|
+
> def buttons text=nil
|
818
|
+
|
819
|
+
Get an array of button texts or button elements if text is provided.
|
820
|
+
|
821
|
+
__Parameters:__
|
822
|
+
|
823
|
+
[String] text - the text to exactly match
|
824
|
+
|
825
|
+
__Returns:__
|
826
|
+
|
827
|
+
[Array<String>, Array<Buttons>] either an array of button texts or an array of button elements if text is provided.
|
828
|
+
|
829
|
+
--
|
830
|
+
|
831
|
+
##### [first_button](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/element/button.rb#L26)
|
832
|
+
|
833
|
+
> def first_button
|
834
|
+
|
835
|
+
Get the first button element.
|
836
|
+
|
837
|
+
__Returns:__
|
838
|
+
|
839
|
+
[Button]
|
840
|
+
|
841
|
+
--
|
842
|
+
|
843
|
+
##### [last_button](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/element/button.rb#L32)
|
844
|
+
|
845
|
+
> def last_button
|
846
|
+
|
847
|
+
Get the last button element.
|
848
|
+
|
849
|
+
__Returns:__
|
850
|
+
|
851
|
+
[Button]
|
852
|
+
|
853
|
+
--
|
854
|
+
|
855
|
+
##### [button_exact](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/element/button.rb#L39)
|
856
|
+
|
857
|
+
> def button_exact text
|
858
|
+
|
859
|
+
Get the first button element that exactly matches text.
|
860
|
+
|
861
|
+
__Parameters:__
|
862
|
+
|
863
|
+
[String] text - the text to match exactly
|
864
|
+
|
865
|
+
__Returns:__
|
866
|
+
|
867
|
+
[Button]
|
868
|
+
|
869
|
+
--
|
870
|
+
|
871
|
+
##### [buttons_exact](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/element/button.rb#L46)
|
872
|
+
|
873
|
+
> def buttons_exact text
|
874
|
+
|
875
|
+
Get all button elements that exactly match text.
|
876
|
+
|
877
|
+
__Parameters:__
|
878
|
+
|
879
|
+
[String] text - the text to match exactly
|
880
|
+
|
881
|
+
__Returns:__
|
882
|
+
|
883
|
+
[Array<Button>]
|
884
|
+
|
885
|
+
--
|
886
|
+
|
887
|
+
##### [e_buttons](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/element/button.rb#L52)
|
888
|
+
|
889
|
+
> def e_buttons
|
890
|
+
|
891
|
+
Get an array of button elements.
|
892
|
+
|
893
|
+
__Returns:__
|
894
|
+
|
895
|
+
[Array<Button>]
|
896
|
+
|
897
|
+
--
|
898
|
+
|
899
|
+
##### [button_num](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/element/button.rb#L72)
|
900
|
+
|
901
|
+
> def button_num text, number=1
|
902
|
+
|
903
|
+
Expected to be called via button method.
|
904
|
+
|
905
|
+
Get the button element exactly matching text and
|
906
|
+
occurrence. number=2 means the 2nd occurrence.
|
907
|
+
|
908
|
+
find the second Sign In button
|
909
|
+
|
910
|
+
b = e_button 'Sign In', 2
|
911
|
+
|
912
|
+
Button order will change in iOS vs Android
|
913
|
+
so if there's no button found at number then
|
914
|
+
return the first button.
|
915
|
+
|
916
|
+
__Parameters:__
|
917
|
+
|
918
|
+
[String] text - the text to match
|
919
|
+
|
920
|
+
[Integer] number - the button occurance to return. 1 = first button
|
921
|
+
|
922
|
+
__Returns:__
|
923
|
+
|
924
|
+
[Button] the button that matches text and number
|
925
|
+
|
926
|
+
--
|
927
|
+
|
928
|
+
##### [window_size](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/element/window.rb#L5)
|
929
|
+
|
930
|
+
> def window_size
|
931
|
+
|
932
|
+
Get the window's size
|
933
|
+
|
934
|
+
--
|
935
|
+
|
936
|
+
##### [find_eles_attr](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/ios/helper.rb#L8) ios
|
937
|
+
|
938
|
+
> def find_eles_attr tag_name, attribute
|
939
|
+
|
940
|
+
iOS only. Android uses uiautomator instead of uiautomation.
|
941
|
+
Get an array of attribute values from elements exactly matching tag name.
|
942
|
+
|
943
|
+
__Parameters:__
|
944
|
+
|
945
|
+
[String] tag_name - the tag name to find
|
946
|
+
|
947
|
+
[String] attribute - the attribute to collect
|
948
|
+
|
949
|
+
__Returns:__
|
950
|
+
|
951
|
+
[Array<String>] an array of strings containing the attribute from found elements of type tag_name.
|
952
|
+
|
953
|
+
--
|
954
|
+
|
955
|
+
##### [find_2_eles_attr](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/ios/helper.rb#L29) ios
|
956
|
+
|
957
|
+
> def find_2_eles_attr tag_name_1, tag_name_2, attribute
|
958
|
+
|
959
|
+
iOS only. Android doesn't use find_2_eles_attr.
|
960
|
+
Get an array of attribute values from elements exactly matching tag name.
|
961
|
+
|
962
|
+
__Parameters:__
|
963
|
+
|
964
|
+
[String] tag_name_1 - the 1st tag name to find
|
965
|
+
|
966
|
+
[String] tag_name_2 - the 2nd tag name to find
|
967
|
+
|
968
|
+
[String] attribute - the attribute to collect
|
969
|
+
|
970
|
+
__Returns:__
|
971
|
+
|
972
|
+
[Array<String>] an array of strings containing the attribute from found elements of type tag_name.
|
973
|
+
|
974
|
+
--
|
975
|
+
|
976
|
+
##### [password](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/ios/helper.rb#L50) ios
|
977
|
+
|
978
|
+
> def password length=1
|
979
|
+
|
980
|
+
iOS only. On Android uiautomator always returns an empty string for EditText password.
|
981
|
+
|
982
|
+
Password character returned from value of UIASecureTextField
|
983
|
+
|
984
|
+
__Parameters:__
|
985
|
+
|
986
|
+
[Integer] length - the length of the password to generate
|
987
|
+
|
988
|
+
__Returns:__
|
989
|
+
|
990
|
+
[String] the returned string is of size length
|
991
|
+
|
992
|
+
--
|
993
|
+
|
994
|
+
##### [get_page](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/ios/helper.rb#L58) ios
|
995
|
+
|
996
|
+
> def get_page element=get_source
|
997
|
+
|
998
|
+
Returns a string of interesting elements. iOS only.
|
999
|
+
|
1000
|
+
__Parameters:__
|
1001
|
+
|
1002
|
+
[Object] element - the element to search. omit to search everything
|
1003
|
+
|
1004
|
+
__Returns:__
|
1005
|
+
|
1006
|
+
[String]
|
1007
|
+
|
1008
|
+
--
|
1009
|
+
|
1010
|
+
##### [page](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/ios/helper.rb#L103) ios
|
1011
|
+
|
1012
|
+
> def page
|
1013
|
+
|
1014
|
+
Prints a string of interesting elements to the console.
|
1015
|
+
|
1016
|
+
__Returns:__
|
1017
|
+
|
1018
|
+
[void]
|
1019
|
+
|
1020
|
+
--
|
1021
|
+
|
1022
|
+
##### [fast_duration](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/ios/helper.rb#L110) ios
|
1023
|
+
|
1024
|
+
> def fast_duration
|
1025
|
+
|
1026
|
+
The fastest duration that can be used on iOS.
|
1027
|
+
|
1028
|
+
__Returns:__
|
1029
|
+
|
1030
|
+
[Float]
|
1031
|
+
|
1032
|
+
--
|
1033
|
+
|
1034
|
+
##### [alert_click](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/ios/element/alert.rb#L14) ios
|
1035
|
+
|
1036
|
+
> def alert_click value
|
1037
|
+
|
1038
|
+
iOS only
|
1039
|
+
Tap the alert button identified by value.
|
1040
|
+
|
1041
|
+
Click the ok button:
|
1042
|
+
alert_click 'OK'
|
1043
|
+
|
1044
|
+
Click the first button:
|
1045
|
+
alert_click 0
|
1046
|
+
|
1047
|
+
__Parameters:__
|
1048
|
+
|
1049
|
+
[Integer, String] value - either an integer index of the button or the button's name
|
1050
|
+
|
1051
|
+
__Returns:__
|
1052
|
+
|
1053
|
+
[void]
|
1054
|
+
|
1055
|
+
--
|
1056
|
+
|
1057
|
+
##### [alert_text](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/ios/element/alert.rb#L21) ios
|
1058
|
+
|
1059
|
+
> def alert_text
|
1060
|
+
|
1061
|
+
Get the alert message text.
|
1062
|
+
|
1063
|
+
__Returns:__
|
1064
|
+
|
1065
|
+
[String]
|
1066
|
+
|
1067
|
+
--
|
1068
|
+
|
1069
|
+
##### [alert_accept](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/ios/element/alert.rb#L27) ios
|
1070
|
+
|
1071
|
+
> def alert_accept
|
1072
|
+
|
1073
|
+
Accept the alert.
|
1074
|
+
|
1075
|
+
__Returns:__
|
1076
|
+
|
1077
|
+
[void]
|
1078
|
+
|
1079
|
+
--
|
1080
|
+
|
1081
|
+
##### [alert_accept_text](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/ios/element/alert.rb#L34) ios
|
1082
|
+
|
1083
|
+
> def alert_accept_text
|
1084
|
+
|
1085
|
+
Get the text of the alert's accept button.
|
1086
|
+
The last button is considered "accept."
|
1087
|
+
|
1088
|
+
__Returns:__
|
1089
|
+
|
1090
|
+
[String]
|
1091
|
+
|
1092
|
+
--
|
1093
|
+
|
1094
|
+
##### [alert_dismiss](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/ios/element/alert.rb#L43) ios
|
1095
|
+
|
1096
|
+
> def alert_dismiss
|
1097
|
+
|
1098
|
+
Dismiss the alert.
|
1099
|
+
|
1100
|
+
__Returns:__
|
1101
|
+
|
1102
|
+
[void]
|
1103
|
+
|
1104
|
+
--
|
1105
|
+
|
1106
|
+
##### [alert_dismiss_text](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/ios/element/alert.rb#L50) ios
|
1107
|
+
|
1108
|
+
> def alert_dismiss_text
|
1109
|
+
|
1110
|
+
Get the text of the alert's dismiss button.
|
1111
|
+
The first button is considered "dismiss."
|
1112
|
+
|
1113
|
+
__Returns:__
|
1114
|
+
|
1115
|
+
[String]
|
1116
|
+
|
1117
|
+
--
|
1118
|
+
|
1119
|
+
##### [find](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/ios/element/generic.rb#L113) ios
|
1120
|
+
|
1121
|
+
> def find text
|
1122
|
+
|
1123
|
+
Return the first element matching text.
|
1124
|
+
|
1125
|
+
__Parameters:__
|
1126
|
+
|
1127
|
+
[String] text - the text to search for
|
1128
|
+
|
1129
|
+
__Returns:__
|
1130
|
+
|
1131
|
+
[Element] the first matching element
|
1132
|
+
|
1133
|
+
--
|
1134
|
+
|
1135
|
+
##### [finds](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/ios/element/generic.rb#L124) ios
|
1136
|
+
|
1137
|
+
> def finds text
|
1138
|
+
|
1139
|
+
Return all elements matching text.
|
1140
|
+
|
1141
|
+
__Parameters:__
|
1142
|
+
|
1143
|
+
[String] text - the text to search for
|
1144
|
+
|
1145
|
+
__Returns:__
|
1146
|
+
|
1147
|
+
[Array<Element>] all matching elements
|
1148
|
+
|
1149
|
+
--
|
1150
|
+
|
1151
|
+
##### [text](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/ios/element/generic.rb#L135) ios
|
1152
|
+
|
1153
|
+
> def text text
|
1154
|
+
|
1155
|
+
Return the first element matching text.
|
1156
|
+
|
1157
|
+
__Parameters:__
|
1158
|
+
|
1159
|
+
[String] text - the text to search for
|
1160
|
+
|
1161
|
+
__Returns:__
|
1162
|
+
|
1163
|
+
[Element] the first matching element
|
1164
|
+
|
1165
|
+
--
|
1166
|
+
|
1167
|
+
##### [texts](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/ios/element/generic.rb#L144) ios
|
1168
|
+
|
1169
|
+
> def texts text
|
1170
|
+
|
1171
|
+
Return all elements matching text.
|
1172
|
+
|
1173
|
+
__Parameters:__
|
1174
|
+
|
1175
|
+
[String] text - the text to search for
|
1176
|
+
|
1177
|
+
__Returns:__
|
1178
|
+
|
1179
|
+
[Array<Element>] all matching elements
|
1180
|
+
|
1181
|
+
--
|
1182
|
+
|
1183
|
+
##### [name](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/ios/element/generic.rb#L157) ios
|
1184
|
+
|
1185
|
+
> def name name
|
1186
|
+
|
1187
|
+
Return the first element matching name.
|
1188
|
+
on Android name is content description
|
1189
|
+
on iOS name is the accessibility label or the text.
|
1190
|
+
|
1191
|
+
__Parameters:__
|
1192
|
+
|
1193
|
+
[String] name - the name to search for
|
1194
|
+
|
1195
|
+
__Returns:__
|
1196
|
+
|
1197
|
+
[Element] the first matching element
|
1198
|
+
|
1199
|
+
--
|
1200
|
+
|
1201
|
+
##### [names](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/ios/element/generic.rb#L166) ios
|
1202
|
+
|
1203
|
+
> def names name
|
1204
|
+
|
1205
|
+
Return all elements matching name.
|
1206
|
+
on Android name is content description
|
1207
|
+
on iOS name is the accessibility label or the text.
|
1208
|
+
|
1209
|
+
__Parameters:__
|
1210
|
+
|
1211
|
+
[String] name - the name to search for
|
1212
|
+
|
1213
|
+
__Returns:__
|
1214
|
+
|
1215
|
+
[Array<Element>] all matching elements
|
1216
|
+
|
1217
|
+
--
|
1218
|
+
|
1219
|
+
##### [textfields](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/ios/element/textfield.rb#L10) ios
|
1220
|
+
|
1221
|
+
> def textfields
|
1222
|
+
|
1223
|
+
Get an array of textfield texts.
|
1224
|
+
|
1225
|
+
__Returns:__
|
1226
|
+
|
1227
|
+
[Array<String>]
|
1228
|
+
|
1229
|
+
--
|
1230
|
+
|
1231
|
+
##### [e_textfields](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/ios/element/textfield.rb#L16) ios
|
1232
|
+
|
1233
|
+
> def e_textfields
|
1234
|
+
|
1235
|
+
Get an array of textfield elements.
|
1236
|
+
|
1237
|
+
__Returns:__
|
1238
|
+
|
1239
|
+
[Array<Textfield>]
|
1240
|
+
|
1241
|
+
--
|
1242
|
+
|
1243
|
+
##### [first_textfield](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/ios/element/textfield.rb#L22) ios
|
1244
|
+
|
1245
|
+
> def first_textfield
|
1246
|
+
|
1247
|
+
Get the first textfield element.
|
1248
|
+
|
1249
|
+
__Returns:__
|
1250
|
+
|
1251
|
+
[Textfield]
|
1252
|
+
|
1253
|
+
--
|
1254
|
+
|
1255
|
+
##### [last_textfield](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/ios/element/textfield.rb#L29) ios
|
1256
|
+
|
1257
|
+
> def last_textfield
|
1258
|
+
|
1259
|
+
Get the last textfield element.
|
1260
|
+
|
1261
|
+
__Returns:__
|
1262
|
+
|
1263
|
+
[Textfield]
|
1264
|
+
|
1265
|
+
--
|
1266
|
+
|
1267
|
+
##### [textfield](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/ios/element/textfield.rb#L37) ios
|
1268
|
+
|
1269
|
+
> def textfield text
|
1270
|
+
|
1271
|
+
Get the first textfield that matches text.
|
1272
|
+
|
1273
|
+
__Parameters:__
|
1274
|
+
|
1275
|
+
[String, Integer] text - the text to match exactly. If int then the textfield at that index is returned.
|
1276
|
+
|
1277
|
+
__Returns:__
|
1278
|
+
|
1279
|
+
[Textfield]
|
1280
|
+
|
1281
|
+
--
|
1282
|
+
|
1283
|
+
##### [textfield_include](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/ios/element/textfield.rb#L51) ios
|
1284
|
+
|
1285
|
+
> def textfield_include text
|
1286
|
+
|
1287
|
+
Get the first textfield that includes text.
|
1288
|
+
|
1289
|
+
__Parameters:__
|
1290
|
+
|
1291
|
+
[String] text - the text the textfield must include
|
1292
|
+
|
1293
|
+
__Returns:__
|
1294
|
+
|
1295
|
+
[Textfield]
|
1296
|
+
|
1297
|
+
--
|
1298
|
+
|
1299
|
+
##### [textfield_exact](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/ios/element/textfield.rb#L64) ios
|
1300
|
+
|
1301
|
+
> def textfield_exact text
|
1302
|
+
|
1303
|
+
Get the first textfield that exactly matches text.
|
1304
|
+
|
1305
|
+
__Parameters:__
|
1306
|
+
|
1307
|
+
[String] text - the text the textfield must exactly match
|
1308
|
+
|
1309
|
+
__Returns:__
|
1310
|
+
|
1311
|
+
[Textfield]
|
1312
|
+
|
1313
|
+
--
|
1314
|
+
|
1315
|
+
##### [value](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/patch.rb#L10)
|
1316
|
+
|
1317
|
+
> def value
|
1318
|
+
|
1319
|
+
Returns the value attribute
|
1320
|
+
|
1321
|
+
Fixes NoMethodError: undefined method `value' for Selenium::WebDriver::Element
|
1322
|
+
|
1323
|
+
--
|
1324
|
+
|
1325
|
+
##### [name](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/patch.rb#L17)
|
1326
|
+
|
1327
|
+
> def name
|
1328
|
+
|
1329
|
+
Returns the name attribute
|
1330
|
+
|
1331
|
+
Fixes NoMethodError: undefined method `name' for Selenium::WebDriver::Element
|
1332
|
+
|
1333
|
+
--
|
1334
|
+
|
1335
|
+
##### [tag_name](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/patch.rb#L24)
|
1336
|
+
|
1337
|
+
> def tag_name
|
1338
|
+
|
1339
|
+
Returns the type attribute
|
1340
|
+
|
1341
|
+
Fixes Selenium::WebDriver::Error::UnknownError: Not yet implemented
|
1342
|
+
|
1343
|
+
--
|
1344
|
+
|
1345
|
+
##### [location_rel](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/patch.rb#L36)
|
1346
|
+
|
1347
|
+
> def location_rel
|
1348
|
+
|
1349
|
+
For use with mobile tap.
|
1350
|
+
|
1351
|
+
```ruby
|
1352
|
+
execute_script 'mobile: tap', :x => 0.0, :y => 0.98
|
1353
|
+
```
|
1354
|
+
|
1355
|
+
https://github.com/appium/appium/wiki/Automating-mobile-gestures
|
1356
|
+
|
1357
|
+
__Returns:__
|
1358
|
+
|
1359
|
+
[OpenStruct] the relative x, y in a struct. ex: { x: 0.50, y: 0.20 }
|
1360
|
+
|
1361
|
+
--
|
1362
|
+
|