appium_lib 8.2.0 → 8.2.1
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 +4 -4
- data/docs/android_docs.md +2418 -4
- data/docs/ios_docs.md +247 -194
- data/lib/appium_lib/common/version.rb +2 -2
- data/lib/appium_lib/device/touch_actions.rb +1 -1
- data/lib/appium_lib/driver.rb +4 -4
- data/release_notes.md +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ed9f191d4e69bd3017099f76c54c733ca5fcb81
|
4
|
+
data.tar.gz: 47179ecf6ebee6cc6a891c6464e7648091202c18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a32d0c3be94251f5e72010d50d2cb2e60171b8e4b4704da85f58b2df3106a01250976c93c6ec288e890925cb5a4441357bb8f55f112c2325ad06c47b60e86c7a
|
7
|
+
data.tar.gz: f8b4adcf915dd2c289c73a9b2ff0435c8f38cfa261a3c0709d7cd2c94de8dfa89dead97423cce7c7e87bdbab881c6b720efb2e74fa0ef969042f13ec7f872bda
|
data/docs/android_docs.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
##### [load_settings](https://github.com/appium/ruby_lib/blob/
|
1
|
+
##### [load_settings](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L69)
|
2
2
|
|
3
3
|
> def self.load_settings(opts = {})
|
4
4
|
|
5
|
-
Load
|
5
|
+
Load arbitrary text (toml format)
|
6
6
|
|
7
7
|
```
|
8
8
|
[caps]
|
@@ -26,11 +26,11 @@ __Returns:__
|
|
26
26
|
|
27
27
|
--
|
28
28
|
|
29
|
-
##### [load_appium_txt](https://github.com/appium/ruby_lib/blob/
|
29
|
+
##### [load_appium_txt](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L102)
|
30
30
|
|
31
31
|
> def self.load_settings(opts = {})
|
32
32
|
|
33
|
-
Load
|
33
|
+
Load arbitrary text (toml format)
|
34
34
|
|
35
35
|
```
|
36
36
|
[caps]
|
@@ -54,3 +54,2417 @@ __Returns:__
|
|
54
54
|
|
55
55
|
--
|
56
56
|
|
57
|
+
##### [expand_required_files](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L108)
|
58
|
+
|
59
|
+
> def self.expand_required_files(base_dir, file_paths)
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
__Parameters:__
|
64
|
+
|
65
|
+
[String] base_dir - parent directory of loaded appium.txt (toml)
|
66
|
+
|
67
|
+
[String] file_paths -
|
68
|
+
|
69
|
+
__Returns:__
|
70
|
+
|
71
|
+
[Array] list of require files as an array, nil if require doesn't exist
|
72
|
+
|
73
|
+
--
|
74
|
+
|
75
|
+
##### [symbolize_keys](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L140)
|
76
|
+
|
77
|
+
> def self.symbolize_keys(hash)
|
78
|
+
|
79
|
+
convert all keys (including nested) to symbols
|
80
|
+
|
81
|
+
based on deep_symbolize_keys & deep_transform_keys from rails
|
82
|
+
https://github.com/rails/docrails/blob/a3b1105ada3da64acfa3843b164b14b734456a50/activesupport/lib/active_support/core_ext/hash/keys.rb#L84
|
83
|
+
|
84
|
+
--
|
85
|
+
|
86
|
+
##### [promote_singleton_appium_methods](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L161)
|
87
|
+
|
88
|
+
> def self.promote_singleton_appium_methods(modules)
|
89
|
+
|
90
|
+
This method is intended to work with page objects that share
|
91
|
+
a common module. For example, Page::HomePage, Page::SignIn
|
92
|
+
those could be promoted on with Appium.promote_singleton_appium_methods Page
|
93
|
+
|
94
|
+
If you are promoting on an individual class then you should use
|
95
|
+
Appium.promote_appium_methods instead. The singleton method is intended
|
96
|
+
only for the shared module use case.
|
97
|
+
|
98
|
+
if modules is a module instead of an array, then the constants of
|
99
|
+
that module are promoted on.
|
100
|
+
otherwise, the array of modules will be used as the promotion target.
|
101
|
+
|
102
|
+
--
|
103
|
+
|
104
|
+
##### [promote_appium_methods](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L212)
|
105
|
+
|
106
|
+
> def self.promote_appium_methods(class_array)
|
107
|
+
|
108
|
+
Promote appium methods to class instance methods
|
109
|
+
|
110
|
+
To promote methods to all classes:
|
111
|
+
|
112
|
+
```ruby
|
113
|
+
Appium.promote_appium_methods Object
|
114
|
+
```
|
115
|
+
|
116
|
+
It's better to promote on specific classes instead of Object
|
117
|
+
|
118
|
+
```ruby
|
119
|
+
# promote on rspec
|
120
|
+
Appium.promote_appium_methods RSpec::Core::ExampleGroup
|
121
|
+
```
|
122
|
+
|
123
|
+
```ruby
|
124
|
+
# promote on minispec
|
125
|
+
Appium.promote_appium_methods Minitest::Spec
|
126
|
+
```
|
127
|
+
|
128
|
+
__Parameters:__
|
129
|
+
|
130
|
+
[Array<Class>] class_array - An array of classes
|
131
|
+
|
132
|
+
--
|
133
|
+
|
134
|
+
##### [global_webdriver_http_sleep](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L246)
|
135
|
+
|
136
|
+
> def global_webdriver_http_sleep
|
137
|
+
|
138
|
+
The amount to sleep in seconds before every webdriver http call.
|
139
|
+
|
140
|
+
--
|
141
|
+
|
142
|
+
##### [global_webdriver_http_sleep=](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L246)
|
143
|
+
|
144
|
+
> def global_webdriver_http_sleep=(value)
|
145
|
+
|
146
|
+
The amount to sleep in seconds before every webdriver http call.
|
147
|
+
|
148
|
+
--
|
149
|
+
|
150
|
+
##### [caps](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L248)
|
151
|
+
|
152
|
+
> def caps
|
153
|
+
|
154
|
+
Selenium webdriver capabilities
|
155
|
+
|
156
|
+
--
|
157
|
+
|
158
|
+
##### [caps=](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L248)
|
159
|
+
|
160
|
+
> def caps=(value)
|
161
|
+
|
162
|
+
Selenium webdriver capabilities
|
163
|
+
|
164
|
+
--
|
165
|
+
|
166
|
+
##### [custom_url](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L250)
|
167
|
+
|
168
|
+
> def custom_url
|
169
|
+
|
170
|
+
Custom URL for the selenium server
|
171
|
+
|
172
|
+
--
|
173
|
+
|
174
|
+
##### [custom_url=](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L250)
|
175
|
+
|
176
|
+
> def custom_url=(value)
|
177
|
+
|
178
|
+
Custom URL for the selenium server
|
179
|
+
|
180
|
+
--
|
181
|
+
|
182
|
+
##### [export_session](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L252)
|
183
|
+
|
184
|
+
> def export_session
|
185
|
+
|
186
|
+
Export session id to textfile in /tmp for 3rd party tools
|
187
|
+
|
188
|
+
--
|
189
|
+
|
190
|
+
##### [export_session=](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L252)
|
191
|
+
|
192
|
+
> def export_session=(value)
|
193
|
+
|
194
|
+
Export session id to textfile in /tmp for 3rd party tools
|
195
|
+
|
196
|
+
--
|
197
|
+
|
198
|
+
##### [default_wait](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L257)
|
199
|
+
|
200
|
+
> def default_wait
|
201
|
+
|
202
|
+
Default wait time for elements to appear
|
203
|
+
Returns the default client side wait.
|
204
|
+
This value is independent of what the server is using
|
205
|
+
|
206
|
+
__Returns:__
|
207
|
+
|
208
|
+
[Integer]
|
209
|
+
|
210
|
+
--
|
211
|
+
|
212
|
+
##### [default_wait=](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L257)
|
213
|
+
|
214
|
+
> def default_wait=(value)
|
215
|
+
|
216
|
+
Default wait time for elements to appear
|
217
|
+
Returns the default client side wait.
|
218
|
+
This value is independent of what the server is using
|
219
|
+
|
220
|
+
__Returns:__
|
221
|
+
|
222
|
+
[Integer]
|
223
|
+
|
224
|
+
--
|
225
|
+
|
226
|
+
##### [last_waits](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L259)
|
227
|
+
|
228
|
+
> def last_waits
|
229
|
+
|
230
|
+
Array of previous wait time values
|
231
|
+
|
232
|
+
--
|
233
|
+
|
234
|
+
##### [last_waits=](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L259)
|
235
|
+
|
236
|
+
> def last_waits=(value)
|
237
|
+
|
238
|
+
Array of previous wait time values
|
239
|
+
|
240
|
+
--
|
241
|
+
|
242
|
+
##### [sauce_username](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L261)
|
243
|
+
|
244
|
+
> def sauce_username
|
245
|
+
|
246
|
+
Username for use on Sauce Labs
|
247
|
+
|
248
|
+
--
|
249
|
+
|
250
|
+
##### [sauce_username=](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L261)
|
251
|
+
|
252
|
+
> def sauce_username=(value)
|
253
|
+
|
254
|
+
Username for use on Sauce Labs
|
255
|
+
|
256
|
+
--
|
257
|
+
|
258
|
+
##### [sauce_access_key](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L263)
|
259
|
+
|
260
|
+
> def sauce_access_key
|
261
|
+
|
262
|
+
Access Key for use on Sauce Labs
|
263
|
+
|
264
|
+
--
|
265
|
+
|
266
|
+
##### [sauce_access_key=](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L263)
|
267
|
+
|
268
|
+
> def sauce_access_key=(value)
|
269
|
+
|
270
|
+
Access Key for use on Sauce Labs
|
271
|
+
|
272
|
+
--
|
273
|
+
|
274
|
+
##### [appium_port](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L265)
|
275
|
+
|
276
|
+
> def appium_port
|
277
|
+
|
278
|
+
Appium's server port
|
279
|
+
|
280
|
+
--
|
281
|
+
|
282
|
+
##### [appium_port=](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L265)
|
283
|
+
|
284
|
+
> def appium_port=(value)
|
285
|
+
|
286
|
+
Appium's server port
|
287
|
+
|
288
|
+
--
|
289
|
+
|
290
|
+
##### [appium_device](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L267)
|
291
|
+
|
292
|
+
> def appium_device
|
293
|
+
|
294
|
+
Device type to request from the appium server
|
295
|
+
|
296
|
+
--
|
297
|
+
|
298
|
+
##### [appium_device=](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L267)
|
299
|
+
|
300
|
+
> def appium_device=(value)
|
301
|
+
|
302
|
+
Device type to request from the appium server
|
303
|
+
|
304
|
+
--
|
305
|
+
|
306
|
+
##### [appium_debug](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L269)
|
307
|
+
|
308
|
+
> def appium_debug
|
309
|
+
|
310
|
+
Boolean debug mode for the Appium Ruby bindings
|
311
|
+
|
312
|
+
--
|
313
|
+
|
314
|
+
##### [appium_debug=](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L269)
|
315
|
+
|
316
|
+
> def appium_debug=(value)
|
317
|
+
|
318
|
+
Boolean debug mode for the Appium Ruby bindings
|
319
|
+
|
320
|
+
--
|
321
|
+
|
322
|
+
##### [listener](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L271)
|
323
|
+
|
324
|
+
> def listener
|
325
|
+
|
326
|
+
instance of AbstractEventListener for logging support
|
327
|
+
|
328
|
+
--
|
329
|
+
|
330
|
+
##### [listener=](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L271)
|
331
|
+
|
332
|
+
> def listener=(value)
|
333
|
+
|
334
|
+
instance of AbstractEventListener for logging support
|
335
|
+
|
336
|
+
--
|
337
|
+
|
338
|
+
##### [driver](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L275)
|
339
|
+
|
340
|
+
> def driver
|
341
|
+
|
342
|
+
Returns the driver
|
343
|
+
|
344
|
+
__Returns:__
|
345
|
+
|
346
|
+
[Driver] the driver
|
347
|
+
|
348
|
+
--
|
349
|
+
|
350
|
+
##### [initialize](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L296)
|
351
|
+
|
352
|
+
> def initialize(opts = {})
|
353
|
+
|
354
|
+
Creates a new driver
|
355
|
+
|
356
|
+
```ruby
|
357
|
+
require 'rubygems'
|
358
|
+
require 'appium_lib'
|
359
|
+
|
360
|
+
# platformName takes a string or a symbol.
|
361
|
+
|
362
|
+
# Start iOS driver
|
363
|
+
opts = { caps: { platformName: :ios, app: '/path/to/MyiOS.app' } }
|
364
|
+
Appium::Driver.new(opts).start_driver
|
365
|
+
|
366
|
+
# Start Android driver
|
367
|
+
opts = { caps: { platformName: :android, app: '/path/to/my.apk' } }
|
368
|
+
Appium::Driver.new(opts).start_driver
|
369
|
+
```
|
370
|
+
|
371
|
+
__Parameters:__
|
372
|
+
|
373
|
+
[Object] opts - A hash containing various options.
|
374
|
+
|
375
|
+
__Returns:__
|
376
|
+
|
377
|
+
[Driver]
|
378
|
+
|
379
|
+
--
|
380
|
+
|
381
|
+
##### [driver_attributes](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L364)
|
382
|
+
|
383
|
+
> def driver_attributes
|
384
|
+
|
385
|
+
Returns a hash of the driver attributes
|
386
|
+
|
387
|
+
--
|
388
|
+
|
389
|
+
##### [device_is_android?](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L385)
|
390
|
+
|
391
|
+
> def device_is_android?
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
__Returns:__
|
396
|
+
|
397
|
+
[Boolean]
|
398
|
+
|
399
|
+
--
|
400
|
+
|
401
|
+
##### [appium_server_version](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L401)
|
402
|
+
|
403
|
+
> def appium_server_version
|
404
|
+
|
405
|
+
Returns the server's version info
|
406
|
+
|
407
|
+
```ruby
|
408
|
+
{
|
409
|
+
"build" => {
|
410
|
+
"version" => "0.18.1",
|
411
|
+
"revision" => "d242ebcfd92046a974347ccc3a28f0e898595198"
|
412
|
+
}
|
413
|
+
}
|
414
|
+
```
|
415
|
+
|
416
|
+
__Returns:__
|
417
|
+
|
418
|
+
[Hash]
|
419
|
+
|
420
|
+
--
|
421
|
+
|
422
|
+
##### [absolute_app_path](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L413)
|
423
|
+
|
424
|
+
> def self.absolute_app_path(opts)
|
425
|
+
|
426
|
+
Converts app_path to an absolute path.
|
427
|
+
|
428
|
+
opts is the full options hash (caps and appium_lib). If server_url is set
|
429
|
+
then the app path is used as is.
|
430
|
+
|
431
|
+
if app isn't set then an error is raised.
|
432
|
+
|
433
|
+
__Returns:__
|
434
|
+
|
435
|
+
[String] APP_PATH as an absolute path
|
436
|
+
|
437
|
+
--
|
438
|
+
|
439
|
+
##### [server_url](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L446)
|
440
|
+
|
441
|
+
> def server_url
|
442
|
+
|
443
|
+
Get the server url
|
444
|
+
|
445
|
+
__Returns:__
|
446
|
+
|
447
|
+
[String] the server url
|
448
|
+
|
449
|
+
--
|
450
|
+
|
451
|
+
##### [restart](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L457)
|
452
|
+
|
453
|
+
> def restart
|
454
|
+
|
455
|
+
Restarts the driver
|
456
|
+
|
457
|
+
__Returns:__
|
458
|
+
|
459
|
+
[Driver] the driver
|
460
|
+
|
461
|
+
--
|
462
|
+
|
463
|
+
##### [screenshot](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L468)
|
464
|
+
|
465
|
+
> def screenshot(png_save_path)
|
466
|
+
|
467
|
+
Takes a png screenshot and saves to the target path.
|
468
|
+
|
469
|
+
Example: screenshot '/tmp/hi.png'
|
470
|
+
|
471
|
+
__Parameters:__
|
472
|
+
|
473
|
+
[String] png_save_path - the full path to save the png
|
474
|
+
|
475
|
+
__Returns:__
|
476
|
+
|
477
|
+
[nil]
|
478
|
+
|
479
|
+
--
|
480
|
+
|
481
|
+
##### [driver_quit](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L475)
|
482
|
+
|
483
|
+
> def driver_quit
|
484
|
+
|
485
|
+
Quits the driver
|
486
|
+
|
487
|
+
__Returns:__
|
488
|
+
|
489
|
+
[void]
|
490
|
+
|
491
|
+
--
|
492
|
+
|
493
|
+
##### [start_driver](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L484)
|
494
|
+
|
495
|
+
> def start_driver
|
496
|
+
|
497
|
+
Creates a new global driver and quits the old one if it exists.
|
498
|
+
|
499
|
+
__Returns:__
|
500
|
+
|
501
|
+
[Selenium::WebDriver] the new global driver
|
502
|
+
|
503
|
+
--
|
504
|
+
|
505
|
+
##### [no_wait](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L517)
|
506
|
+
|
507
|
+
> def no_wait
|
508
|
+
|
509
|
+
Set implicit wait and default_wait to zero.
|
510
|
+
|
511
|
+
--
|
512
|
+
|
513
|
+
##### [set_wait](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L536)
|
514
|
+
|
515
|
+
> def set_wait(timeout = nil)
|
516
|
+
|
517
|
+
Set implicit wait and default_wait to timeout, defaults to 30.
|
518
|
+
if set_wait is called without a param then the second to last
|
519
|
+
wait will be used.
|
520
|
+
|
521
|
+
```ruby`
|
522
|
+
set_wait 2
|
523
|
+
set_wait 3
|
524
|
+
set_wait # 2
|
525
|
+
|
526
|
+
````
|
527
|
+
|
528
|
+
__Parameters:__
|
529
|
+
|
530
|
+
[Integer] timeout - the timeout in seconds
|
531
|
+
|
532
|
+
__Returns:__
|
533
|
+
|
534
|
+
[void]
|
535
|
+
|
536
|
+
--
|
537
|
+
|
538
|
+
##### [exists](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L563)
|
539
|
+
|
540
|
+
> def exists(pre_check = 0, post_check = @default_wait, &search_block)
|
541
|
+
|
542
|
+
Returns existence of element.
|
543
|
+
|
544
|
+
Example:
|
545
|
+
|
546
|
+
exists { button('sign in') } ? puts('true') : puts('false')
|
547
|
+
|
548
|
+
__Parameters:__
|
549
|
+
|
550
|
+
[Integer] pre_check - the amount in seconds to set the
|
551
|
+
wait to before checking existance
|
552
|
+
|
553
|
+
[Integer] post_check - the amount in seconds to set the
|
554
|
+
wait to after checking existance
|
555
|
+
|
556
|
+
[Block] search_block - the block to call
|
557
|
+
|
558
|
+
__Returns:__
|
559
|
+
|
560
|
+
[Boolean]
|
561
|
+
|
562
|
+
--
|
563
|
+
|
564
|
+
##### [execute_script](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L587)
|
565
|
+
|
566
|
+
> def execute_script(script, *args)
|
567
|
+
|
568
|
+
The same as @driver.execute_script
|
569
|
+
|
570
|
+
__Parameters:__
|
571
|
+
|
572
|
+
[String] script - the script to execute
|
573
|
+
|
574
|
+
[*args] args - the args to pass to the script
|
575
|
+
|
576
|
+
__Returns:__
|
577
|
+
|
578
|
+
[Object]
|
579
|
+
|
580
|
+
--
|
581
|
+
|
582
|
+
##### [find_elements](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L595)
|
583
|
+
|
584
|
+
> def find_elements(*args)
|
585
|
+
|
586
|
+
Calls @driver.find_elements
|
587
|
+
|
588
|
+
__Parameters:__
|
589
|
+
|
590
|
+
[*args] args - the args to use
|
591
|
+
|
592
|
+
__Returns:__
|
593
|
+
|
594
|
+
[Array<Element>] Array is empty when no elements are found.
|
595
|
+
|
596
|
+
--
|
597
|
+
|
598
|
+
##### [find_element](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L603)
|
599
|
+
|
600
|
+
> def find_element(*args)
|
601
|
+
|
602
|
+
Calls @driver.find_elements
|
603
|
+
|
604
|
+
__Parameters:__
|
605
|
+
|
606
|
+
[*args] args - the args to use
|
607
|
+
|
608
|
+
__Returns:__
|
609
|
+
|
610
|
+
[Element]
|
611
|
+
|
612
|
+
--
|
613
|
+
|
614
|
+
##### [set_location](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L616)
|
615
|
+
|
616
|
+
> def set_location(opts = {})
|
617
|
+
|
618
|
+
Calls @driver.set_location
|
619
|
+
|
620
|
+
__Parameters:__
|
621
|
+
|
622
|
+
[Hash] opts - consisting of:
|
623
|
+
|
624
|
+
__Returns:__
|
625
|
+
|
626
|
+
[Selenium::WebDriver::Location] the location constructed by the selenium webdriver
|
627
|
+
|
628
|
+
--
|
629
|
+
|
630
|
+
##### [x](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/driver.rb#L626)
|
631
|
+
|
632
|
+
> def x
|
633
|
+
|
634
|
+
Quit the driver and Pry.
|
635
|
+
quit and exit are reserved by Pry.
|
636
|
+
|
637
|
+
__Returns:__
|
638
|
+
|
639
|
+
[void]
|
640
|
+
|
641
|
+
--
|
642
|
+
|
643
|
+
##### [logger=](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/logger.rb#L13)
|
644
|
+
|
645
|
+
> def logger=(value)
|
646
|
+
|
647
|
+
Sets the attribute logger
|
648
|
+
|
649
|
+
__Parameters:__
|
650
|
+
|
651
|
+
value - the value to set the attribute logger to.
|
652
|
+
|
653
|
+
--
|
654
|
+
|
655
|
+
##### [logger](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/logger.rb#L17)
|
656
|
+
|
657
|
+
> def logger
|
658
|
+
|
659
|
+
|
660
|
+
|
661
|
+
--
|
662
|
+
|
663
|
+
##### [NoArgMethods](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/device.rb#L7)
|
664
|
+
|
665
|
+
> NoArgMethods = {
|
666
|
+
|
667
|
+
|
668
|
+
|
669
|
+
--
|
670
|
+
|
671
|
+
##### [app_strings](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/device.rb#L25)
|
672
|
+
|
673
|
+
> def app_strings
|
674
|
+
|
675
|
+
Return the hash of all localization strings.
|
676
|
+
```ruby
|
677
|
+
app_strings #=> "TransitionsTitle"=>"Transitions", "WebTitle"=>"Web"
|
678
|
+
```
|
679
|
+
|
680
|
+
--
|
681
|
+
|
682
|
+
##### [background_app](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/device.rb#L31)
|
683
|
+
|
684
|
+
> def background_app
|
685
|
+
|
686
|
+
Backgrounds the app for a set number of seconds.
|
687
|
+
This is a blocking application
|
688
|
+
|
689
|
+
--
|
690
|
+
|
691
|
+
##### [current_activity](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/device.rb#L36)
|
692
|
+
|
693
|
+
> def current_activity
|
694
|
+
|
695
|
+
|
696
|
+
|
697
|
+
--
|
698
|
+
|
699
|
+
##### [launch_app](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/device.rb#L38)
|
700
|
+
|
701
|
+
> def launch_app
|
702
|
+
|
703
|
+
Start the simulator and application configured with desired capabilities
|
704
|
+
|
705
|
+
--
|
706
|
+
|
707
|
+
##### [reset](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/device.rb#L41)
|
708
|
+
|
709
|
+
> def reset
|
710
|
+
|
711
|
+
Reset the device, relaunching the application.
|
712
|
+
|
713
|
+
--
|
714
|
+
|
715
|
+
##### [shake](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/device.rb#L44)
|
716
|
+
|
717
|
+
> def shake
|
718
|
+
|
719
|
+
Cause the device to shake
|
720
|
+
|
721
|
+
--
|
722
|
+
|
723
|
+
##### [toggle_flight_mode](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/device.rb#L47)
|
724
|
+
|
725
|
+
> def toggle_flight_mode
|
726
|
+
|
727
|
+
Toggle flight mode on or off
|
728
|
+
|
729
|
+
--
|
730
|
+
|
731
|
+
##### [device_locked?](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/device.rb#L50)
|
732
|
+
|
733
|
+
> def device_locked?
|
734
|
+
|
735
|
+
|
736
|
+
|
737
|
+
--
|
738
|
+
|
739
|
+
##### [hide_keyboard](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/device.rb#L52)
|
740
|
+
|
741
|
+
> def hide_keyboard
|
742
|
+
|
743
|
+
Hide the onscreen keyboard
|
744
|
+
|
745
|
+
__Parameters:__
|
746
|
+
|
747
|
+
[String] close_key - the name of the key which closes the keyboard.
|
748
|
+
Defaults to 'Done'.
|
749
|
+
|
750
|
+
--
|
751
|
+
|
752
|
+
##### [press_keycode](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/device.rb#L61)
|
753
|
+
|
754
|
+
> def press_keycode
|
755
|
+
|
756
|
+
Press keycode on the device.
|
757
|
+
http://developer.android.com/reference/android/view/KeyEvent.html
|
758
|
+
|
759
|
+
__Parameters:__
|
760
|
+
|
761
|
+
[integer] key - The key to press.
|
762
|
+
|
763
|
+
[String] metastate - The state the metakeys should be in when pressing the key.
|
764
|
+
|
765
|
+
--
|
766
|
+
|
767
|
+
##### [long_press_keycode](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/device.rb#L67)
|
768
|
+
|
769
|
+
> def long_press_keycode
|
770
|
+
|
771
|
+
Long press keycode on the device.
|
772
|
+
http://developer.android.com/reference/android/view/KeyEvent.html
|
773
|
+
|
774
|
+
__Parameters:__
|
775
|
+
|
776
|
+
[integer] key - The key to long press.
|
777
|
+
|
778
|
+
[String] metastate - The state the metakeys should be in when long pressing the key.
|
779
|
+
|
780
|
+
--
|
781
|
+
|
782
|
+
##### [push_file](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/device.rb#L73)
|
783
|
+
|
784
|
+
> def push_file
|
785
|
+
|
786
|
+
Place a file in a specific location on the device.
|
787
|
+
|
788
|
+
__Parameters:__
|
789
|
+
|
790
|
+
[String] path - The absolute path on the device to store data at.
|
791
|
+
|
792
|
+
[String] data - Raw file data to be sent to the device.
|
793
|
+
|
794
|
+
--
|
795
|
+
|
796
|
+
##### [pull_file](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/device.rb#L78)
|
797
|
+
|
798
|
+
> def pull_file
|
799
|
+
|
800
|
+
Retrieve a file from the device. This can retrieve an absolute path or
|
801
|
+
a path relative to the installed app (iOS only).
|
802
|
+
```ruby
|
803
|
+
pull_file '/local/data/some/path' #=> Get the file at that path
|
804
|
+
pull_file 'Shenanigans.app/some/file' #=> Get 'some/file' from the install location of Shenanigans.app
|
805
|
+
```
|
806
|
+
|
807
|
+
__Parameters:__
|
808
|
+
|
809
|
+
[String] path - Either an absolute path OR, for iOS devices, a path relative to the app, as described.
|
810
|
+
|
811
|
+
--
|
812
|
+
|
813
|
+
##### [pull_folder](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/device.rb#L88)
|
814
|
+
|
815
|
+
> def pull_folder
|
816
|
+
|
817
|
+
Retrieve a folder from the device.
|
818
|
+
```ruby
|
819
|
+
pull_folder '/data/local/tmp' #=> Get the folder at that path
|
820
|
+
```
|
821
|
+
|
822
|
+
__Parameters:__
|
823
|
+
|
824
|
+
[String] path - absolute path to the folder
|
825
|
+
|
826
|
+
--
|
827
|
+
|
828
|
+
##### [touch_id](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/device.rb#L96)
|
829
|
+
|
830
|
+
> def touch_id
|
831
|
+
|
832
|
+
iOS only; Simulate Touch ID with either valid (match == true) or invalid (match == false) fingerprint.
|
833
|
+
```ruby
|
834
|
+
touch_id true #=> Simulate valid fingerprint
|
835
|
+
touch_id false #=> Simulate invalid fingerprint
|
836
|
+
```
|
837
|
+
|
838
|
+
__Parameters:__
|
839
|
+
|
840
|
+
[Boolean] match - fingerprint validity
|
841
|
+
Defaults to true.
|
842
|
+
|
843
|
+
--
|
844
|
+
|
845
|
+
##### [end_coverage](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/device.rb#L105)
|
846
|
+
|
847
|
+
> def end_coverage
|
848
|
+
|
849
|
+
Android only; Ends the test coverage and writes the results to the given path on device.
|
850
|
+
|
851
|
+
__Parameters:__
|
852
|
+
|
853
|
+
[String] path - Path on the device to write too.
|
854
|
+
|
855
|
+
[String] intent - Intent to broadcast when ending coverage.
|
856
|
+
|
857
|
+
--
|
858
|
+
|
859
|
+
##### [get_settings](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/device.rb#L110)
|
860
|
+
|
861
|
+
> def get_settings
|
862
|
+
|
863
|
+
Get appium Settings for current test session
|
864
|
+
|
865
|
+
--
|
866
|
+
|
867
|
+
##### [extend_search_contexts](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/device.rb#L394)
|
868
|
+
|
869
|
+
> def extend_search_contexts
|
870
|
+
|
871
|
+
|
872
|
+
|
873
|
+
--
|
874
|
+
|
875
|
+
##### [find_element](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/device.rb#L394)
|
876
|
+
|
877
|
+
> def find_element
|
878
|
+
|
879
|
+
|
880
|
+
|
881
|
+
--
|
882
|
+
|
883
|
+
##### [find_elements](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/device.rb#L394)
|
884
|
+
|
885
|
+
> def find_elements
|
886
|
+
|
887
|
+
find_element/s with their accessibility_id
|
888
|
+
|
889
|
+
```ruby
|
890
|
+
find_elements :accessibility_id, 'Animation'
|
891
|
+
```
|
892
|
+
|
893
|
+
--
|
894
|
+
|
895
|
+
##### [add_touch_actions](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/device.rb#L400)
|
896
|
+
|
897
|
+
> def add_touch_actions
|
898
|
+
|
899
|
+
|
900
|
+
|
901
|
+
--
|
902
|
+
|
903
|
+
##### [add_ime_actions](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/device.rb#L423)
|
904
|
+
|
905
|
+
> def add_ime_actions
|
906
|
+
|
907
|
+
|
908
|
+
|
909
|
+
--
|
910
|
+
|
911
|
+
##### [set_context](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/device.rb#L498)
|
912
|
+
|
913
|
+
> def set_context
|
914
|
+
|
915
|
+
Change the context to the given context.
|
916
|
+
```ruby
|
917
|
+
set_context "NATIVE_APP"
|
918
|
+
```
|
919
|
+
|
920
|
+
__Parameters:__
|
921
|
+
|
922
|
+
[String] The - context to change to
|
923
|
+
|
924
|
+
--
|
925
|
+
|
926
|
+
##### [current_context](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/device.rb#L506)
|
927
|
+
|
928
|
+
> def current_context
|
929
|
+
|
930
|
+
|
931
|
+
|
932
|
+
__Returns:__
|
933
|
+
|
934
|
+
[String] The context currently being used.
|
935
|
+
|
936
|
+
--
|
937
|
+
|
938
|
+
##### [available_contexts](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/device.rb#L509)
|
939
|
+
|
940
|
+
> def available_contexts
|
941
|
+
|
942
|
+
|
943
|
+
|
944
|
+
__Returns:__
|
945
|
+
|
946
|
+
[Array<String>] All usable contexts, as an array of strings.
|
947
|
+
|
948
|
+
--
|
949
|
+
|
950
|
+
##### [within_context](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/device.rb#L519)
|
951
|
+
|
952
|
+
> def within_context(context)
|
953
|
+
|
954
|
+
Perform a block within the given context, then switch back to the starting context.
|
955
|
+
```ruby
|
956
|
+
within_context('NATIVE_APP') do
|
957
|
+
find_element [:tag, "button"]
|
958
|
+
```
|
959
|
+
|
960
|
+
__Parameters:__
|
961
|
+
|
962
|
+
[String] context - The context to switch to for the duration of the block.
|
963
|
+
|
964
|
+
--
|
965
|
+
|
966
|
+
##### [switch_to_default_context](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/device.rb#L527)
|
967
|
+
|
968
|
+
> def switch_to_default_context
|
969
|
+
|
970
|
+
Change to the default context. This is equivalent to `set_context nil`.
|
971
|
+
|
972
|
+
--
|
973
|
+
|
974
|
+
##### [pinch](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/multi_touch.rb#L28)
|
975
|
+
|
976
|
+
> def pinch(percentage = 25, auto_perform = true)
|
977
|
+
|
978
|
+
Convenience method for pinching the screen.
|
979
|
+
Places two fingers at the edges of the screen and brings them together.
|
980
|
+
```ruby
|
981
|
+
action = pinch 75 #=> Pinch the screen from the top right and bottom left corners
|
982
|
+
action.perform #=> to 25% of its size.
|
983
|
+
```
|
984
|
+
|
985
|
+
__Parameters:__
|
986
|
+
|
987
|
+
[int] percentage - The percent size by which to shrink the screen when pinched.
|
988
|
+
|
989
|
+
[boolean] auto_perform - Whether to perform the action immediately (default true)
|
990
|
+
|
991
|
+
--
|
992
|
+
|
993
|
+
##### [zoom](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/multi_touch.rb#L56)
|
994
|
+
|
995
|
+
> def zoom(percentage = 200, auto_perform = true)
|
996
|
+
|
997
|
+
Convenience method for zooming the screen.
|
998
|
+
Places two fingers at the edges of the screen and brings them together.
|
999
|
+
```ruby
|
1000
|
+
action = zoom 200 #=> Zoom in the screen from the center until it doubles in size.
|
1001
|
+
action.perform
|
1002
|
+
```
|
1003
|
+
|
1004
|
+
__Parameters:__
|
1005
|
+
|
1006
|
+
[int] percentage - The percent size by which to shrink the screen when pinched.
|
1007
|
+
|
1008
|
+
[boolean] auto_perform - Whether to perform the action immediately (default true)
|
1009
|
+
|
1010
|
+
--
|
1011
|
+
|
1012
|
+
##### [initialize](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/multi_touch.rb#L77)
|
1013
|
+
|
1014
|
+
> def initialize
|
1015
|
+
|
1016
|
+
Create a new multi-action
|
1017
|
+
|
1018
|
+
__Returns:__
|
1019
|
+
|
1020
|
+
[MultiTouch] a new instance of MultiTouch
|
1021
|
+
|
1022
|
+
--
|
1023
|
+
|
1024
|
+
##### [add](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/multi_touch.rb#L83)
|
1025
|
+
|
1026
|
+
> def add(chain)
|
1027
|
+
|
1028
|
+
Add a touch_action to be performed
|
1029
|
+
|
1030
|
+
__Parameters:__
|
1031
|
+
|
1032
|
+
[TouchAction] chain - The action to add to the chain
|
1033
|
+
|
1034
|
+
--
|
1035
|
+
|
1036
|
+
##### [perform](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/multi_touch.rb#L88)
|
1037
|
+
|
1038
|
+
> def perform
|
1039
|
+
|
1040
|
+
Ask Appium to perform the actions
|
1041
|
+
|
1042
|
+
--
|
1043
|
+
|
1044
|
+
##### [ACTIONS](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/touch_actions.rb#L11)
|
1045
|
+
|
1046
|
+
> ACTIONS = [:move_to, :long_press, :double_tap, :two_finger_tap, :press, :release, :tap, :wait, :perform]
|
1047
|
+
|
1048
|
+
|
1049
|
+
|
1050
|
+
--
|
1051
|
+
|
1052
|
+
##### [COMPLEX_ACTIONS](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/touch_actions.rb#L12)
|
1053
|
+
|
1054
|
+
> COMPLEX_ACTIONS = [:swipe]
|
1055
|
+
|
1056
|
+
|
1057
|
+
|
1058
|
+
--
|
1059
|
+
|
1060
|
+
##### [actions](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/touch_actions.rb#L26)
|
1061
|
+
|
1062
|
+
> def actions
|
1063
|
+
|
1064
|
+
Returns the value of attribute actions
|
1065
|
+
|
1066
|
+
--
|
1067
|
+
|
1068
|
+
##### [initialize](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/touch_actions.rb#L28)
|
1069
|
+
|
1070
|
+
> def initialize
|
1071
|
+
|
1072
|
+
|
1073
|
+
|
1074
|
+
__Returns:__
|
1075
|
+
|
1076
|
+
[TouchAction] a new instance of TouchAction
|
1077
|
+
|
1078
|
+
--
|
1079
|
+
|
1080
|
+
##### [move_to](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/touch_actions.rb#L36)
|
1081
|
+
|
1082
|
+
> def move_to(opts)
|
1083
|
+
|
1084
|
+
Move to the given co-ordinates.
|
1085
|
+
|
1086
|
+
__Parameters:__
|
1087
|
+
|
1088
|
+
[Hash] opts - a customizable set of options
|
1089
|
+
|
1090
|
+
--
|
1091
|
+
|
1092
|
+
##### [long_press](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/touch_actions.rb#L46)
|
1093
|
+
|
1094
|
+
> def long_press(opts)
|
1095
|
+
|
1096
|
+
Press down for a specific duration.
|
1097
|
+
|
1098
|
+
__Parameters:__
|
1099
|
+
|
1100
|
+
[Hash] element - a customizable set of options
|
1101
|
+
|
1102
|
+
[Hash] x - a customizable set of options
|
1103
|
+
|
1104
|
+
[Hash] y - a customizable set of options
|
1105
|
+
|
1106
|
+
[Hash] duration - a customizable set of options
|
1107
|
+
|
1108
|
+
--
|
1109
|
+
|
1110
|
+
##### [press](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/touch_actions.rb#L58)
|
1111
|
+
|
1112
|
+
> def press(opts)
|
1113
|
+
|
1114
|
+
Press a finger onto the screen. Finger will stay down until you call
|
1115
|
+
`release`.
|
1116
|
+
|
1117
|
+
__Parameters:__
|
1118
|
+
|
1119
|
+
[Hash] opts - a customizable set of options
|
1120
|
+
|
1121
|
+
--
|
1122
|
+
|
1123
|
+
##### [release](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/touch_actions.rb#L69)
|
1124
|
+
|
1125
|
+
> def release(opts = nil)
|
1126
|
+
|
1127
|
+
Remove a finger from the screen.
|
1128
|
+
|
1129
|
+
__Parameters:__
|
1130
|
+
|
1131
|
+
[Hash] opts - a customizable set of options
|
1132
|
+
|
1133
|
+
--
|
1134
|
+
|
1135
|
+
##### [tap](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/touch_actions.rb#L80)
|
1136
|
+
|
1137
|
+
> def tap(opts)
|
1138
|
+
|
1139
|
+
Touch a point on the screen
|
1140
|
+
|
1141
|
+
__Parameters:__
|
1142
|
+
|
1143
|
+
[Hash] opts - a customizable set of options
|
1144
|
+
|
1145
|
+
--
|
1146
|
+
|
1147
|
+
##### [double_tap](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/touch_actions.rb#L93)
|
1148
|
+
|
1149
|
+
> def double_tap(opts)
|
1150
|
+
|
1151
|
+
Double tap an element on the screen
|
1152
|
+
|
1153
|
+
__Parameters:__
|
1154
|
+
|
1155
|
+
[Hash] opts - a customizable set of options
|
1156
|
+
|
1157
|
+
--
|
1158
|
+
|
1159
|
+
##### [two_finger_tap](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/touch_actions.rb#L104)
|
1160
|
+
|
1161
|
+
> def two_finger_tap(opts)
|
1162
|
+
|
1163
|
+
Two finger tap an element on the screen
|
1164
|
+
|
1165
|
+
__Parameters:__
|
1166
|
+
|
1167
|
+
[Hash] opts - a customizable set of options
|
1168
|
+
|
1169
|
+
--
|
1170
|
+
|
1171
|
+
##### [wait](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/touch_actions.rb#L112)
|
1172
|
+
|
1173
|
+
> def wait(milliseconds)
|
1174
|
+
|
1175
|
+
Pause for a number of milliseconds before the next action
|
1176
|
+
|
1177
|
+
__Parameters:__
|
1178
|
+
|
1179
|
+
[integer] milliseconds - Number of milliseconds to pause for
|
1180
|
+
|
1181
|
+
--
|
1182
|
+
|
1183
|
+
##### [swipe](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/touch_actions.rb#L127)
|
1184
|
+
|
1185
|
+
> def swipe(opts)
|
1186
|
+
|
1187
|
+
Convenience method to peform a swipe.
|
1188
|
+
|
1189
|
+
Note that iOS 7 simulators have broken swipe.
|
1190
|
+
|
1191
|
+
__Parameters:__
|
1192
|
+
|
1193
|
+
[Hash] opts - a customizable set of options
|
1194
|
+
|
1195
|
+
--
|
1196
|
+
|
1197
|
+
##### [perform](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/touch_actions.rb#L155)
|
1198
|
+
|
1199
|
+
> def perform
|
1200
|
+
|
1201
|
+
Ask the driver to perform all actions in this action chain.
|
1202
|
+
|
1203
|
+
--
|
1204
|
+
|
1205
|
+
##### [cancel](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/touch_actions.rb#L161)
|
1206
|
+
|
1207
|
+
> def cancel
|
1208
|
+
|
1209
|
+
Does nothing, currently.
|
1210
|
+
|
1211
|
+
--
|
1212
|
+
|
1213
|
+
##### [chain_method](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/touch_actions.rb#L169)
|
1214
|
+
|
1215
|
+
> def chain_method(method, args = nil)
|
1216
|
+
|
1217
|
+
|
1218
|
+
|
1219
|
+
--
|
1220
|
+
|
1221
|
+
##### [args_with_ele_ref](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/device/touch_actions.rb#L178)
|
1222
|
+
|
1223
|
+
> def args_with_ele_ref(args)
|
1224
|
+
|
1225
|
+
|
1226
|
+
|
1227
|
+
--
|
1228
|
+
|
1229
|
+
##### [_generic_wait](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/wait.rb#L9)
|
1230
|
+
|
1231
|
+
> def _generic_wait(opts = {}, &block)
|
1232
|
+
|
1233
|
+
Wait code from the selenium Ruby gem
|
1234
|
+
https://github.com/SeleniumHQ/selenium/blob/cf501dda3f0ed12233de51ce8170c0e8090f0c20/rb/lib/selenium/webdriver/common/wait.rb
|
1235
|
+
|
1236
|
+
--
|
1237
|
+
|
1238
|
+
##### [_process_wait_opts](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/wait.rb#L54)
|
1239
|
+
|
1240
|
+
> def _process_wait_opts(opts)
|
1241
|
+
|
1242
|
+
process opts before calling _generic_wait
|
1243
|
+
|
1244
|
+
--
|
1245
|
+
|
1246
|
+
##### [wait_true](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/wait.rb#L75)
|
1247
|
+
|
1248
|
+
> def wait_true(opts = {}, &block)
|
1249
|
+
|
1250
|
+
Check every interval seconds to see if block.call returns a truthy value.
|
1251
|
+
Note this isn't a strict boolean true, any truthy value is accepted.
|
1252
|
+
false and nil are considered failures.
|
1253
|
+
Give up after timeout seconds.
|
1254
|
+
|
1255
|
+
Wait code from the selenium Ruby gem
|
1256
|
+
https://github.com/SeleniumHQ/selenium/blob/cf501dda3f0ed12233de51ce8170c0e8090f0c20/rb/lib/selenium/webdriver/common/wait.rb
|
1257
|
+
|
1258
|
+
If only a number is provided then it's treated as the timeout value.
|
1259
|
+
|
1260
|
+
__Parameters:__
|
1261
|
+
|
1262
|
+
[Hash] opts - Options
|
1263
|
+
|
1264
|
+
--
|
1265
|
+
|
1266
|
+
##### [wait](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/wait.rb#L93)
|
1267
|
+
|
1268
|
+
> def wait(opts = {}, &block)
|
1269
|
+
|
1270
|
+
Check every interval seconds to see if block.call doesn't raise an exception.
|
1271
|
+
Give up after timeout seconds.
|
1272
|
+
|
1273
|
+
Wait code from the selenium Ruby gem
|
1274
|
+
https://github.com/SeleniumHQ/selenium/blob/cf501dda3f0ed12233de51ce8170c0e8090f0c20/rb/lib/selenium/webdriver/common/wait.rb
|
1275
|
+
|
1276
|
+
If only a number is provided then it's treated as the timeout value.
|
1277
|
+
|
1278
|
+
__Parameters:__
|
1279
|
+
|
1280
|
+
[Hash] opts - Options
|
1281
|
+
|
1282
|
+
--
|
1283
|
+
|
1284
|
+
##### [ignore](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/helper.rb#L24)
|
1285
|
+
|
1286
|
+
> def ignore(&block)
|
1287
|
+
|
1288
|
+
Return block.call and ignore any exceptions.
|
1289
|
+
|
1290
|
+
--
|
1291
|
+
|
1292
|
+
##### [back](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/helper.rb#L31)
|
1293
|
+
|
1294
|
+
> def back
|
1295
|
+
|
1296
|
+
Navigate back.
|
1297
|
+
|
1298
|
+
__Returns:__
|
1299
|
+
|
1300
|
+
[void]
|
1301
|
+
|
1302
|
+
--
|
1303
|
+
|
1304
|
+
##### [session_id](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/helper.rb#L36)
|
1305
|
+
|
1306
|
+
> def session_id
|
1307
|
+
|
1308
|
+
For Sauce Labs reporting. Returns the current session id.
|
1309
|
+
|
1310
|
+
--
|
1311
|
+
|
1312
|
+
##### [xpath](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/helper.rb#L44)
|
1313
|
+
|
1314
|
+
> def xpath(xpath_str)
|
1315
|
+
|
1316
|
+
Returns the first element that matches the provided xpath.
|
1317
|
+
|
1318
|
+
__Parameters:__
|
1319
|
+
|
1320
|
+
[String] xpath_str - the XPath string
|
1321
|
+
|
1322
|
+
__Returns:__
|
1323
|
+
|
1324
|
+
[Element]
|
1325
|
+
|
1326
|
+
--
|
1327
|
+
|
1328
|
+
##### [xpaths](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/helper.rb#L52)
|
1329
|
+
|
1330
|
+
> def xpaths(xpath_str)
|
1331
|
+
|
1332
|
+
Returns all elements that match the provided xpath.
|
1333
|
+
|
1334
|
+
__Parameters:__
|
1335
|
+
|
1336
|
+
[String] xpath_str - the XPath string
|
1337
|
+
|
1338
|
+
__Returns:__
|
1339
|
+
|
1340
|
+
[Array<Element>]
|
1341
|
+
|
1342
|
+
--
|
1343
|
+
|
1344
|
+
##### [_print_source](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/helper.rb#L56)
|
1345
|
+
|
1346
|
+
> def _print_source(source)
|
1347
|
+
|
1348
|
+
|
1349
|
+
|
1350
|
+
--
|
1351
|
+
|
1352
|
+
##### [result](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/helper.rb#L69)
|
1353
|
+
|
1354
|
+
> def result
|
1355
|
+
|
1356
|
+
Returns the value of attribute result
|
1357
|
+
|
1358
|
+
--
|
1359
|
+
|
1360
|
+
##### [initialize](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/helper.rb#L71)
|
1361
|
+
|
1362
|
+
> def initialize
|
1363
|
+
|
1364
|
+
|
1365
|
+
|
1366
|
+
__Returns:__
|
1367
|
+
|
1368
|
+
[CountElements] a new instance of CountElements
|
1369
|
+
|
1370
|
+
--
|
1371
|
+
|
1372
|
+
##### [reset](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/helper.rb#L75)
|
1373
|
+
|
1374
|
+
> def reset
|
1375
|
+
|
1376
|
+
|
1377
|
+
|
1378
|
+
--
|
1379
|
+
|
1380
|
+
##### [start_element](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/helper.rb#L80)
|
1381
|
+
|
1382
|
+
> def start_element(name, attrs = [])
|
1383
|
+
|
1384
|
+
http://nokogiri.org/Nokogiri/XML/SAX/Document.html
|
1385
|
+
|
1386
|
+
--
|
1387
|
+
|
1388
|
+
##### [formatted_result](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/helper.rb#L86)
|
1389
|
+
|
1390
|
+
> def formatted_result
|
1391
|
+
|
1392
|
+
|
1393
|
+
|
1394
|
+
--
|
1395
|
+
|
1396
|
+
##### [get_page_class](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/helper.rb#L97)
|
1397
|
+
|
1398
|
+
> def get_page_class
|
1399
|
+
|
1400
|
+
Returns a string of class counts of visible elements.
|
1401
|
+
|
1402
|
+
--
|
1403
|
+
|
1404
|
+
##### [page_class](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/helper.rb#L108)
|
1405
|
+
|
1406
|
+
> def page_class
|
1407
|
+
|
1408
|
+
Count all classes on screen and print to stdout.
|
1409
|
+
Useful for appium_console.
|
1410
|
+
|
1411
|
+
--
|
1412
|
+
|
1413
|
+
##### [px_to_window_rel](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/helper.rb#L118)
|
1414
|
+
|
1415
|
+
> def px_to_window_rel(opts = {})
|
1416
|
+
|
1417
|
+
Converts pixel values to window relative values
|
1418
|
+
|
1419
|
+
```ruby
|
1420
|
+
px_to_window_rel x: 50, y: 150
|
1421
|
+
```
|
1422
|
+
|
1423
|
+
--
|
1424
|
+
|
1425
|
+
##### [xml_keys](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/helper.rb#L137)
|
1426
|
+
|
1427
|
+
> def xml_keys(target)
|
1428
|
+
|
1429
|
+
Search strings.xml's values for target.
|
1430
|
+
|
1431
|
+
__Parameters:__
|
1432
|
+
|
1433
|
+
[String] target - the target to search for in strings.xml values
|
1434
|
+
|
1435
|
+
__Returns:__
|
1436
|
+
|
1437
|
+
[Array]
|
1438
|
+
|
1439
|
+
--
|
1440
|
+
|
1441
|
+
##### [xml_values](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/helper.rb#L145)
|
1442
|
+
|
1443
|
+
> def xml_values(target)
|
1444
|
+
|
1445
|
+
Search strings.xml's keys for target.
|
1446
|
+
|
1447
|
+
__Parameters:__
|
1448
|
+
|
1449
|
+
[String] target - the target to search for in strings.xml keys
|
1450
|
+
|
1451
|
+
__Returns:__
|
1452
|
+
|
1453
|
+
[Array]
|
1454
|
+
|
1455
|
+
--
|
1456
|
+
|
1457
|
+
##### [resolve_id](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/helper.rb#L153)
|
1458
|
+
|
1459
|
+
> def resolve_id(id)
|
1460
|
+
|
1461
|
+
Resolve id in strings.xml and return the value.
|
1462
|
+
|
1463
|
+
__Parameters:__
|
1464
|
+
|
1465
|
+
[String] id - the id to resolve
|
1466
|
+
|
1467
|
+
__Returns:__
|
1468
|
+
|
1469
|
+
[String]
|
1470
|
+
|
1471
|
+
--
|
1472
|
+
|
1473
|
+
##### [filter](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/helper.rb#L159)
|
1474
|
+
|
1475
|
+
> def filter
|
1476
|
+
|
1477
|
+
Returns the value of attribute filter
|
1478
|
+
|
1479
|
+
--
|
1480
|
+
|
1481
|
+
##### [filter=](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/helper.rb#L162)
|
1482
|
+
|
1483
|
+
> def filter=(value)
|
1484
|
+
|
1485
|
+
convert to string to support symbols
|
1486
|
+
|
1487
|
+
--
|
1488
|
+
|
1489
|
+
##### [initialize](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/helper.rb#L168)
|
1490
|
+
|
1491
|
+
> def initialize
|
1492
|
+
|
1493
|
+
|
1494
|
+
|
1495
|
+
__Returns:__
|
1496
|
+
|
1497
|
+
[HTMLElements] a new instance of HTMLElements
|
1498
|
+
|
1499
|
+
--
|
1500
|
+
|
1501
|
+
##### [reset](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/helper.rb#L173)
|
1502
|
+
|
1503
|
+
> def reset
|
1504
|
+
|
1505
|
+
|
1506
|
+
|
1507
|
+
--
|
1508
|
+
|
1509
|
+
##### [result](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/helper.rb#L179)
|
1510
|
+
|
1511
|
+
> def result
|
1512
|
+
|
1513
|
+
|
1514
|
+
|
1515
|
+
--
|
1516
|
+
|
1517
|
+
##### [start_element](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/helper.rb#L195)
|
1518
|
+
|
1519
|
+
> def start_element(name, attrs = [])
|
1520
|
+
|
1521
|
+
|
1522
|
+
|
1523
|
+
--
|
1524
|
+
|
1525
|
+
##### [end_element](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/helper.rb#L204)
|
1526
|
+
|
1527
|
+
> def end_element(name)
|
1528
|
+
|
1529
|
+
|
1530
|
+
|
1531
|
+
--
|
1532
|
+
|
1533
|
+
##### [characters](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/helper.rb#L210)
|
1534
|
+
|
1535
|
+
> def characters(chars)
|
1536
|
+
|
1537
|
+
|
1538
|
+
|
1539
|
+
--
|
1540
|
+
|
1541
|
+
##### [_no_such_element](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/helper.rb#L217)
|
1542
|
+
|
1543
|
+
> def _no_such_element
|
1544
|
+
|
1545
|
+
|
1546
|
+
|
1547
|
+
--
|
1548
|
+
|
1549
|
+
##### [window_size](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/element/window.rb#L5)
|
1550
|
+
|
1551
|
+
> def window_size
|
1552
|
+
|
1553
|
+
Get the window's size
|
1554
|
+
|
1555
|
+
--
|
1556
|
+
|
1557
|
+
##### [result](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/helper.rb#L6) android
|
1558
|
+
|
1559
|
+
> def result
|
1560
|
+
|
1561
|
+
Returns the value of attribute result
|
1562
|
+
|
1563
|
+
--
|
1564
|
+
|
1565
|
+
##### [keys](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/helper.rb#L6) android
|
1566
|
+
|
1567
|
+
> def keys
|
1568
|
+
|
1569
|
+
Returns the value of attribute keys
|
1570
|
+
|
1571
|
+
--
|
1572
|
+
|
1573
|
+
##### [instance](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/helper.rb#L6) android
|
1574
|
+
|
1575
|
+
> def instance
|
1576
|
+
|
1577
|
+
Returns the value of attribute instance
|
1578
|
+
|
1579
|
+
--
|
1580
|
+
|
1581
|
+
##### [filter](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/helper.rb#L6) android
|
1582
|
+
|
1583
|
+
> def filter
|
1584
|
+
|
1585
|
+
Returns the value of attribute filter
|
1586
|
+
|
1587
|
+
--
|
1588
|
+
|
1589
|
+
##### [filter=](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/helper.rb#L9) android
|
1590
|
+
|
1591
|
+
> def filter=(value)
|
1592
|
+
|
1593
|
+
convert to string to support symbols
|
1594
|
+
|
1595
|
+
--
|
1596
|
+
|
1597
|
+
##### [initialize](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/helper.rb#L15) android
|
1598
|
+
|
1599
|
+
> def initialize
|
1600
|
+
|
1601
|
+
|
1602
|
+
|
1603
|
+
__Returns:__
|
1604
|
+
|
1605
|
+
[AndroidElements] a new instance of AndroidElements
|
1606
|
+
|
1607
|
+
--
|
1608
|
+
|
1609
|
+
##### [reset](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/helper.rb#L21) android
|
1610
|
+
|
1611
|
+
> def reset
|
1612
|
+
|
1613
|
+
|
1614
|
+
|
1615
|
+
--
|
1616
|
+
|
1617
|
+
##### [start_element](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/helper.rb#L28) android
|
1618
|
+
|
1619
|
+
> def start_element(name, attrs = [])
|
1620
|
+
|
1621
|
+
http://nokogiri.org/Nokogiri/XML/SAX/Document.html
|
1622
|
+
|
1623
|
+
--
|
1624
|
+
|
1625
|
+
##### [_fix_android_native_source](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/helper.rb#L88) android
|
1626
|
+
|
1627
|
+
> def _fix_android_native_source(source)
|
1628
|
+
|
1629
|
+
Fix uiautomator's xml dump.
|
1630
|
+
https://github.com/appium/appium/issues/2822
|
1631
|
+
https://code.google.com/p/android/issues/detail?id=74143
|
1632
|
+
|
1633
|
+
--
|
1634
|
+
|
1635
|
+
##### [source](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/helper.rb#L116) android
|
1636
|
+
|
1637
|
+
> def source
|
1638
|
+
|
1639
|
+
Prints xml of the current page
|
1640
|
+
|
1641
|
+
__Returns:__
|
1642
|
+
|
1643
|
+
[void]
|
1644
|
+
|
1645
|
+
--
|
1646
|
+
|
1647
|
+
##### [get_android_inspect](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/helper.rb#L126) android
|
1648
|
+
|
1649
|
+
> def get_android_inspect(class_name = false)
|
1650
|
+
|
1651
|
+
Android only.
|
1652
|
+
Returns a string containing interesting elements.
|
1653
|
+
The text, content description, and id are returned.
|
1654
|
+
if false (default) then all classes will be inspected
|
1655
|
+
|
1656
|
+
__Parameters:__
|
1657
|
+
|
1658
|
+
[String] class_name - the class name to filter on.
|
1659
|
+
|
1660
|
+
__Returns:__
|
1661
|
+
|
1662
|
+
[String]
|
1663
|
+
|
1664
|
+
--
|
1665
|
+
|
1666
|
+
##### [page](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/helper.rb#L152) android
|
1667
|
+
|
1668
|
+
> def page(opts = {})
|
1669
|
+
|
1670
|
+
Intended for use with console.
|
1671
|
+
Inspects and prints the current page.
|
1672
|
+
Will return XHTML for Web contexts because of a quirk with Nokogiri.
|
1673
|
+
if nil (default) then all classes will be inspected
|
1674
|
+
|
1675
|
+
__Parameters:__
|
1676
|
+
|
1677
|
+
[Hash] class - a customizable set of options
|
1678
|
+
|
1679
|
+
__Returns:__
|
1680
|
+
|
1681
|
+
[void]
|
1682
|
+
|
1683
|
+
--
|
1684
|
+
|
1685
|
+
##### [current_app](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/helper.rb#L164) android
|
1686
|
+
|
1687
|
+
> def current_app
|
1688
|
+
|
1689
|
+
example line:
|
1690
|
+
"mFocusedApp=AppWindowToken{b1420058 token=Token{b128add0
|
1691
|
+
ActivityRecord{b1264d10 u0 com.example.android.apis/.ApiDemos t23}}}"
|
1692
|
+
|
1693
|
+
--
|
1694
|
+
|
1695
|
+
##### [id](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/helper.rb#L188) android
|
1696
|
+
|
1697
|
+
> def id(id)
|
1698
|
+
|
1699
|
+
Find the first matching element by id
|
1700
|
+
|
1701
|
+
__Parameters:__
|
1702
|
+
|
1703
|
+
[String] id - the id to search for
|
1704
|
+
|
1705
|
+
__Returns:__
|
1706
|
+
|
1707
|
+
[Element]
|
1708
|
+
|
1709
|
+
--
|
1710
|
+
|
1711
|
+
##### [ids](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/helper.rb#L196) android
|
1712
|
+
|
1713
|
+
> def ids(id)
|
1714
|
+
|
1715
|
+
Find all matching elements by id
|
1716
|
+
|
1717
|
+
__Parameters:__
|
1718
|
+
|
1719
|
+
[String] id - the id to search for
|
1720
|
+
|
1721
|
+
__Returns:__
|
1722
|
+
|
1723
|
+
[Element]
|
1724
|
+
|
1725
|
+
--
|
1726
|
+
|
1727
|
+
##### [ele_index](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/helper.rb#L205) android
|
1728
|
+
|
1729
|
+
> def ele_index(class_name, index)
|
1730
|
+
|
1731
|
+
Find the element of type class_name at matching index.
|
1732
|
+
|
1733
|
+
__Parameters:__
|
1734
|
+
|
1735
|
+
[String] class_name - the class name to find
|
1736
|
+
|
1737
|
+
[Integer] index - the index
|
1738
|
+
|
1739
|
+
__Returns:__
|
1740
|
+
|
1741
|
+
[Element] the found element of type class_name
|
1742
|
+
|
1743
|
+
--
|
1744
|
+
|
1745
|
+
##### [first_ele](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/helper.rb#L223) android
|
1746
|
+
|
1747
|
+
> def first_ele(class_name)
|
1748
|
+
|
1749
|
+
Find the first element that matches class_name
|
1750
|
+
|
1751
|
+
__Parameters:__
|
1752
|
+
|
1753
|
+
[String] class_name - the tag to match
|
1754
|
+
|
1755
|
+
__Returns:__
|
1756
|
+
|
1757
|
+
[Element]
|
1758
|
+
|
1759
|
+
--
|
1760
|
+
|
1761
|
+
##### [last_ele](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/helper.rb#L230) android
|
1762
|
+
|
1763
|
+
> def last_ele(class_name)
|
1764
|
+
|
1765
|
+
Find the last element that matches class_name
|
1766
|
+
|
1767
|
+
__Parameters:__
|
1768
|
+
|
1769
|
+
[String] class_name - the tag to match
|
1770
|
+
|
1771
|
+
__Returns:__
|
1772
|
+
|
1773
|
+
[Element]
|
1774
|
+
|
1775
|
+
--
|
1776
|
+
|
1777
|
+
##### [tag](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/helper.rb#L238) android
|
1778
|
+
|
1779
|
+
> def tag(class_name)
|
1780
|
+
|
1781
|
+
Find the first element of type class_name
|
1782
|
+
|
1783
|
+
__Parameters:__
|
1784
|
+
|
1785
|
+
[String] class_name - the class_name to search for
|
1786
|
+
|
1787
|
+
__Returns:__
|
1788
|
+
|
1789
|
+
[Element]
|
1790
|
+
|
1791
|
+
--
|
1792
|
+
|
1793
|
+
##### [tags](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/helper.rb#L246) android
|
1794
|
+
|
1795
|
+
> def tags(class_name)
|
1796
|
+
|
1797
|
+
Find all elements of type class_name
|
1798
|
+
|
1799
|
+
__Parameters:__
|
1800
|
+
|
1801
|
+
[String] class_name - the class_name to search for
|
1802
|
+
|
1803
|
+
__Returns:__
|
1804
|
+
|
1805
|
+
[Element]
|
1806
|
+
|
1807
|
+
--
|
1808
|
+
|
1809
|
+
##### [string_visible_contains](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/helper.rb#L288) android
|
1810
|
+
|
1811
|
+
> def string_visible_contains(class_name, value)
|
1812
|
+
|
1813
|
+
Returns a string that matches the first element that contains value
|
1814
|
+
|
1815
|
+
example: complex_find_contains 'UIATextField', 'sign in'
|
1816
|
+
|
1817
|
+
__Parameters:__
|
1818
|
+
|
1819
|
+
[String] class_name - the class name for the element
|
1820
|
+
|
1821
|
+
[String] value - the value to search for
|
1822
|
+
|
1823
|
+
__Returns:__
|
1824
|
+
|
1825
|
+
[String]
|
1826
|
+
|
1827
|
+
--
|
1828
|
+
|
1829
|
+
##### [complex_find_contains](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/helper.rb#L308) android
|
1830
|
+
|
1831
|
+
> def complex_find_contains(element, value)
|
1832
|
+
|
1833
|
+
Find the first element that contains value
|
1834
|
+
|
1835
|
+
__Parameters:__
|
1836
|
+
|
1837
|
+
[String] element - the class name for the element
|
1838
|
+
|
1839
|
+
[String] value - the value to search for
|
1840
|
+
|
1841
|
+
__Returns:__
|
1842
|
+
|
1843
|
+
[Element]
|
1844
|
+
|
1845
|
+
--
|
1846
|
+
|
1847
|
+
##### [complex_finds_contains](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/helper.rb#L316) android
|
1848
|
+
|
1849
|
+
> def complex_finds_contains(element, value)
|
1850
|
+
|
1851
|
+
Find all elements containing value
|
1852
|
+
|
1853
|
+
__Parameters:__
|
1854
|
+
|
1855
|
+
[String] element - the class name for the element
|
1856
|
+
|
1857
|
+
[String] value - the value to search for
|
1858
|
+
|
1859
|
+
__Returns:__
|
1860
|
+
|
1861
|
+
[Array<Element>]
|
1862
|
+
|
1863
|
+
--
|
1864
|
+
|
1865
|
+
##### [complex_find_exact](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/helper.rb#L345) android
|
1866
|
+
|
1867
|
+
> def complex_find_exact(class_name, value)
|
1868
|
+
|
1869
|
+
Find the first element exactly matching value
|
1870
|
+
|
1871
|
+
__Parameters:__
|
1872
|
+
|
1873
|
+
[String] class_name - the class name for the element
|
1874
|
+
|
1875
|
+
[String] value - the value to search for
|
1876
|
+
|
1877
|
+
__Returns:__
|
1878
|
+
|
1879
|
+
[Element]
|
1880
|
+
|
1881
|
+
--
|
1882
|
+
|
1883
|
+
##### [complex_finds_exact](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/helper.rb#L353) android
|
1884
|
+
|
1885
|
+
> def complex_finds_exact(class_name, value)
|
1886
|
+
|
1887
|
+
Find all elements exactly matching value
|
1888
|
+
|
1889
|
+
__Parameters:__
|
1890
|
+
|
1891
|
+
[String] class_name - the class name for the element
|
1892
|
+
|
1893
|
+
[String] value - the value to search for
|
1894
|
+
|
1895
|
+
__Returns:__
|
1896
|
+
|
1897
|
+
[Element]
|
1898
|
+
|
1899
|
+
--
|
1900
|
+
|
1901
|
+
##### [get_source](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/helper.rb#L361) android
|
1902
|
+
|
1903
|
+
> def get_source
|
1904
|
+
|
1905
|
+
Returns XML string for the current page
|
1906
|
+
Fixes uiautomator's $ in node names.
|
1907
|
+
`android.app.ActionBar$Tab` becomes `android.app.ActionBar.Tab`
|
1908
|
+
|
1909
|
+
__Returns:__
|
1910
|
+
|
1911
|
+
[String]
|
1912
|
+
|
1913
|
+
--
|
1914
|
+
|
1915
|
+
##### [TextView](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/text.rb#L4) android
|
1916
|
+
|
1917
|
+
> TextView = 'android.widget.TextView'
|
1918
|
+
|
1919
|
+
|
1920
|
+
|
1921
|
+
--
|
1922
|
+
|
1923
|
+
##### [text](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/text.rb#L10) android
|
1924
|
+
|
1925
|
+
> def text(value)
|
1926
|
+
|
1927
|
+
Find the first TextView that contains value or by index.
|
1928
|
+
If int then the TextView at that index is returned.
|
1929
|
+
|
1930
|
+
__Parameters:__
|
1931
|
+
|
1932
|
+
[String, Integer] value - the value to find.
|
1933
|
+
|
1934
|
+
__Returns:__
|
1935
|
+
|
1936
|
+
[TextView]
|
1937
|
+
|
1938
|
+
--
|
1939
|
+
|
1940
|
+
##### [texts](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/text.rb#L19) android
|
1941
|
+
|
1942
|
+
> def texts(value = false)
|
1943
|
+
|
1944
|
+
Find all TextViews containing value.
|
1945
|
+
If value is omitted, all texts are returned.
|
1946
|
+
|
1947
|
+
__Parameters:__
|
1948
|
+
|
1949
|
+
[String] value - the value to search for
|
1950
|
+
|
1951
|
+
__Returns:__
|
1952
|
+
|
1953
|
+
[Array<TextView>]
|
1954
|
+
|
1955
|
+
--
|
1956
|
+
|
1957
|
+
##### [first_text](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/text.rb#L26) android
|
1958
|
+
|
1959
|
+
> def first_text
|
1960
|
+
|
1961
|
+
Find the first TextView.
|
1962
|
+
|
1963
|
+
__Returns:__
|
1964
|
+
|
1965
|
+
[TextView]
|
1966
|
+
|
1967
|
+
--
|
1968
|
+
|
1969
|
+
##### [last_text](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/text.rb#L32) android
|
1970
|
+
|
1971
|
+
> def last_text
|
1972
|
+
|
1973
|
+
Find the last TextView.
|
1974
|
+
|
1975
|
+
__Returns:__
|
1976
|
+
|
1977
|
+
[TextView]
|
1978
|
+
|
1979
|
+
--
|
1980
|
+
|
1981
|
+
##### [text_exact](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/text.rb#L39) android
|
1982
|
+
|
1983
|
+
> def text_exact(value)
|
1984
|
+
|
1985
|
+
Find the first TextView that exactly matches value.
|
1986
|
+
|
1987
|
+
__Parameters:__
|
1988
|
+
|
1989
|
+
[String] value - the value to match exactly
|
1990
|
+
|
1991
|
+
__Returns:__
|
1992
|
+
|
1993
|
+
[TextView]
|
1994
|
+
|
1995
|
+
--
|
1996
|
+
|
1997
|
+
##### [texts_exact](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/text.rb#L46) android
|
1998
|
+
|
1999
|
+
> def texts_exact(value)
|
2000
|
+
|
2001
|
+
Find all TextViews that exactly match value.
|
2002
|
+
|
2003
|
+
__Parameters:__
|
2004
|
+
|
2005
|
+
[String] value - the value to match exactly
|
2006
|
+
|
2007
|
+
__Returns:__
|
2008
|
+
|
2009
|
+
[Array<TextView>]
|
2010
|
+
|
2011
|
+
--
|
2012
|
+
|
2013
|
+
##### [_nodeset_to_uiselector](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/client_xpath.rb#L5) android
|
2014
|
+
|
2015
|
+
> def _nodeset_to_uiselector(opts = {})
|
2016
|
+
|
2017
|
+
|
2018
|
+
|
2019
|
+
--
|
2020
|
+
|
2021
|
+
##### [_client_xpath](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/client_xpath.rb#L20) android
|
2022
|
+
|
2023
|
+
> def _client_xpath(opts = {})
|
2024
|
+
|
2025
|
+
|
2026
|
+
|
2027
|
+
--
|
2028
|
+
|
2029
|
+
##### [client_xpath](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/client_xpath.rb#L36) android
|
2030
|
+
|
2031
|
+
> def client_xpath(xpath)
|
2032
|
+
|
2033
|
+
|
2034
|
+
|
2035
|
+
--
|
2036
|
+
|
2037
|
+
##### [client_xpaths](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/client_xpath.rb#L40) android
|
2038
|
+
|
2039
|
+
> def client_xpaths(xpath)
|
2040
|
+
|
2041
|
+
|
2042
|
+
|
2043
|
+
--
|
2044
|
+
|
2045
|
+
##### [alert_click](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/alert.rb#L6) android
|
2046
|
+
|
2047
|
+
> def alert_click(value)
|
2048
|
+
|
2049
|
+
Click the first alert button that contains value or by index.
|
2050
|
+
|
2051
|
+
__Parameters:__
|
2052
|
+
|
2053
|
+
[Integer, String] value - either an integer index of the button or the button's name
|
2054
|
+
|
2055
|
+
__Returns:__
|
2056
|
+
|
2057
|
+
[void]
|
2058
|
+
|
2059
|
+
--
|
2060
|
+
|
2061
|
+
##### [alert_accept](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/alert.rb#L13) android
|
2062
|
+
|
2063
|
+
> def alert_accept
|
2064
|
+
|
2065
|
+
Accept the alert.
|
2066
|
+
The last button is considered "accept."
|
2067
|
+
|
2068
|
+
__Returns:__
|
2069
|
+
|
2070
|
+
[void]
|
2071
|
+
|
2072
|
+
--
|
2073
|
+
|
2074
|
+
##### [alert_accept_text](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/alert.rb#L20) android
|
2075
|
+
|
2076
|
+
> def alert_accept_text
|
2077
|
+
|
2078
|
+
Get the text of the alert's accept button.
|
2079
|
+
The last button is considered "accept."
|
2080
|
+
|
2081
|
+
__Returns:__
|
2082
|
+
|
2083
|
+
[String]
|
2084
|
+
|
2085
|
+
--
|
2086
|
+
|
2087
|
+
##### [alert_dismiss](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/alert.rb#L27) android
|
2088
|
+
|
2089
|
+
> def alert_dismiss
|
2090
|
+
|
2091
|
+
Dismiss the alert.
|
2092
|
+
The first button is considered "dismiss."
|
2093
|
+
|
2094
|
+
__Returns:__
|
2095
|
+
|
2096
|
+
[void]
|
2097
|
+
|
2098
|
+
--
|
2099
|
+
|
2100
|
+
##### [alert_dismiss_text](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/alert.rb#L34) android
|
2101
|
+
|
2102
|
+
> def alert_dismiss_text
|
2103
|
+
|
2104
|
+
Get the text of the alert's dismiss button.
|
2105
|
+
The first button is considered "dismiss."
|
2106
|
+
|
2107
|
+
__Returns:__
|
2108
|
+
|
2109
|
+
[String]
|
2110
|
+
|
2111
|
+
--
|
2112
|
+
|
2113
|
+
##### [Button](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/button.rb#L4) android
|
2114
|
+
|
2115
|
+
> Button = 'android.widget.Button'
|
2116
|
+
|
2117
|
+
|
2118
|
+
|
2119
|
+
--
|
2120
|
+
|
2121
|
+
##### [ImageButton](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/button.rb#L5) android
|
2122
|
+
|
2123
|
+
> ImageButton = 'android.widget.ImageButton'
|
2124
|
+
|
2125
|
+
|
2126
|
+
|
2127
|
+
--
|
2128
|
+
|
2129
|
+
##### [button](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/button.rb#L43) android
|
2130
|
+
|
2131
|
+
> def button(value)
|
2132
|
+
|
2133
|
+
Find the first button that contains value or by index.
|
2134
|
+
If int then the button at that index is returned.
|
2135
|
+
|
2136
|
+
__Parameters:__
|
2137
|
+
|
2138
|
+
[String, Integer] value - the value to exactly match.
|
2139
|
+
|
2140
|
+
__Returns:__
|
2141
|
+
|
2142
|
+
[Button]
|
2143
|
+
|
2144
|
+
--
|
2145
|
+
|
2146
|
+
##### [buttons](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/button.rb#L60) android
|
2147
|
+
|
2148
|
+
> def buttons(value = false)
|
2149
|
+
|
2150
|
+
Find all buttons containing value.
|
2151
|
+
If value is omitted, all buttons are returned.
|
2152
|
+
|
2153
|
+
__Parameters:__
|
2154
|
+
|
2155
|
+
[String] value - the value to search for
|
2156
|
+
|
2157
|
+
__Returns:__
|
2158
|
+
|
2159
|
+
[Array<Button>]
|
2160
|
+
|
2161
|
+
--
|
2162
|
+
|
2163
|
+
##### [first_button](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/button.rb#L67) android
|
2164
|
+
|
2165
|
+
> def first_button
|
2166
|
+
|
2167
|
+
Find the first button.
|
2168
|
+
|
2169
|
+
__Returns:__
|
2170
|
+
|
2171
|
+
[Button]
|
2172
|
+
|
2173
|
+
--
|
2174
|
+
|
2175
|
+
##### [last_button](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/button.rb#L73) android
|
2176
|
+
|
2177
|
+
> def last_button
|
2178
|
+
|
2179
|
+
Find the last button.
|
2180
|
+
|
2181
|
+
__Returns:__
|
2182
|
+
|
2183
|
+
[Button]
|
2184
|
+
|
2185
|
+
--
|
2186
|
+
|
2187
|
+
##### [button_exact](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/button.rb#L89) android
|
2188
|
+
|
2189
|
+
> def button_exact(value)
|
2190
|
+
|
2191
|
+
Find the first button that exactly matches value.
|
2192
|
+
|
2193
|
+
__Parameters:__
|
2194
|
+
|
2195
|
+
[String] value - the value to match exactly
|
2196
|
+
|
2197
|
+
__Returns:__
|
2198
|
+
|
2199
|
+
[Button]
|
2200
|
+
|
2201
|
+
--
|
2202
|
+
|
2203
|
+
##### [buttons_exact](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/button.rb#L96) android
|
2204
|
+
|
2205
|
+
> def buttons_exact(value)
|
2206
|
+
|
2207
|
+
Find all buttons that exactly match value.
|
2208
|
+
|
2209
|
+
__Parameters:__
|
2210
|
+
|
2211
|
+
[String] value - the value to match exactly
|
2212
|
+
|
2213
|
+
__Returns:__
|
2214
|
+
|
2215
|
+
[Array<Button>]
|
2216
|
+
|
2217
|
+
--
|
2218
|
+
|
2219
|
+
##### [uiautomator_find](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/mobile_methods.rb#L10) android
|
2220
|
+
|
2221
|
+
> def uiautomator_find
|
2222
|
+
|
2223
|
+
find_element/s can be used with a [UISelector](http://developer.android.com/tools/help/uiautomator/UiSelector.html).
|
2224
|
+
|
2225
|
+
```ruby
|
2226
|
+
find_elements :uiautomator, 'new UiSelector().clickable(true)'
|
2227
|
+
```
|
2228
|
+
|
2229
|
+
--
|
2230
|
+
|
2231
|
+
##### [find](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/generic.rb#L6) android
|
2232
|
+
|
2233
|
+
> def find(value)
|
2234
|
+
|
2235
|
+
Find the first element containing value
|
2236
|
+
|
2237
|
+
__Parameters:__
|
2238
|
+
|
2239
|
+
[String] value - the value to search for
|
2240
|
+
|
2241
|
+
__Returns:__
|
2242
|
+
|
2243
|
+
[Element]
|
2244
|
+
|
2245
|
+
--
|
2246
|
+
|
2247
|
+
##### [finds](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/generic.rb#L13) android
|
2248
|
+
|
2249
|
+
> def finds(value)
|
2250
|
+
|
2251
|
+
Find all elements containing value
|
2252
|
+
|
2253
|
+
__Parameters:__
|
2254
|
+
|
2255
|
+
[String] value - the value to search for
|
2256
|
+
|
2257
|
+
__Returns:__
|
2258
|
+
|
2259
|
+
[Array<Element>]
|
2260
|
+
|
2261
|
+
--
|
2262
|
+
|
2263
|
+
##### [find_exact](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/generic.rb#L20) android
|
2264
|
+
|
2265
|
+
> def find_exact(value)
|
2266
|
+
|
2267
|
+
Find the first element exactly matching value
|
2268
|
+
|
2269
|
+
__Parameters:__
|
2270
|
+
|
2271
|
+
[String] value - the value to search for
|
2272
|
+
|
2273
|
+
__Returns:__
|
2274
|
+
|
2275
|
+
[Element]
|
2276
|
+
|
2277
|
+
--
|
2278
|
+
|
2279
|
+
##### [finds_exact](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/generic.rb#L27) android
|
2280
|
+
|
2281
|
+
> def finds_exact(value)
|
2282
|
+
|
2283
|
+
Find all elements exactly matching value
|
2284
|
+
|
2285
|
+
__Parameters:__
|
2286
|
+
|
2287
|
+
[String] value - the value to search for
|
2288
|
+
|
2289
|
+
__Returns:__
|
2290
|
+
|
2291
|
+
[Array<Element>]
|
2292
|
+
|
2293
|
+
--
|
2294
|
+
|
2295
|
+
##### [scroll_to](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/generic.rb#L39) android
|
2296
|
+
|
2297
|
+
> def scroll_to(text)
|
2298
|
+
|
2299
|
+
Scroll to the first element containing target text or description.
|
2300
|
+
|
2301
|
+
__Parameters:__
|
2302
|
+
|
2303
|
+
[String] text - the text to search for in the text value and content description
|
2304
|
+
|
2305
|
+
__Returns:__
|
2306
|
+
|
2307
|
+
[Element] the element scrolled to
|
2308
|
+
|
2309
|
+
--
|
2310
|
+
|
2311
|
+
##### [scroll_to_exact](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/generic.rb#L51) android
|
2312
|
+
|
2313
|
+
> def scroll_to_exact(text)
|
2314
|
+
|
2315
|
+
Scroll to the first element with the exact target text or description.
|
2316
|
+
|
2317
|
+
__Parameters:__
|
2318
|
+
|
2319
|
+
[String] text - the text to search for in the text value and content description
|
2320
|
+
|
2321
|
+
__Returns:__
|
2322
|
+
|
2323
|
+
[Element] the element scrolled to
|
2324
|
+
|
2325
|
+
--
|
2326
|
+
|
2327
|
+
##### [EditText](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/textfield.rb#L3) android
|
2328
|
+
|
2329
|
+
> EditText = 'android.widget.EditText'
|
2330
|
+
|
2331
|
+
|
2332
|
+
|
2333
|
+
--
|
2334
|
+
|
2335
|
+
##### [textfield](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/textfield.rb#L9) android
|
2336
|
+
|
2337
|
+
> def textfield(value)
|
2338
|
+
|
2339
|
+
Find the first EditText that contains value or by index.
|
2340
|
+
If int then the EditText at that index is returned.
|
2341
|
+
|
2342
|
+
__Parameters:__
|
2343
|
+
|
2344
|
+
[String, Integer] value - the text to match exactly.
|
2345
|
+
|
2346
|
+
__Returns:__
|
2347
|
+
|
2348
|
+
[EditText]
|
2349
|
+
|
2350
|
+
--
|
2351
|
+
|
2352
|
+
##### [textfields](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/textfield.rb#L18) android
|
2353
|
+
|
2354
|
+
> def textfields(value = false)
|
2355
|
+
|
2356
|
+
Find all EditTexts containing value.
|
2357
|
+
If value is omitted, all EditTexts are returned.
|
2358
|
+
|
2359
|
+
__Parameters:__
|
2360
|
+
|
2361
|
+
[String] value - the value to search for
|
2362
|
+
|
2363
|
+
__Returns:__
|
2364
|
+
|
2365
|
+
[Array<EditText>]
|
2366
|
+
|
2367
|
+
--
|
2368
|
+
|
2369
|
+
##### [first_textfield](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/textfield.rb#L25) android
|
2370
|
+
|
2371
|
+
> def first_textfield
|
2372
|
+
|
2373
|
+
Find the first EditText.
|
2374
|
+
|
2375
|
+
__Returns:__
|
2376
|
+
|
2377
|
+
[EditText]
|
2378
|
+
|
2379
|
+
--
|
2380
|
+
|
2381
|
+
##### [last_textfield](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/textfield.rb#L31) android
|
2382
|
+
|
2383
|
+
> def last_textfield
|
2384
|
+
|
2385
|
+
Find the last EditText.
|
2386
|
+
|
2387
|
+
__Returns:__
|
2388
|
+
|
2389
|
+
[EditText]
|
2390
|
+
|
2391
|
+
--
|
2392
|
+
|
2393
|
+
##### [textfield_exact](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/textfield.rb#L38) android
|
2394
|
+
|
2395
|
+
> def textfield_exact(value)
|
2396
|
+
|
2397
|
+
Find the first EditText that exactly matches value.
|
2398
|
+
|
2399
|
+
__Parameters:__
|
2400
|
+
|
2401
|
+
[String] value - the value to match exactly
|
2402
|
+
|
2403
|
+
__Returns:__
|
2404
|
+
|
2405
|
+
[EditText]
|
2406
|
+
|
2407
|
+
--
|
2408
|
+
|
2409
|
+
##### [textfields_exact](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/android/element/textfield.rb#L45) android
|
2410
|
+
|
2411
|
+
> def textfields_exact(value)
|
2412
|
+
|
2413
|
+
Find all EditTexts that exactly match value.
|
2414
|
+
|
2415
|
+
__Parameters:__
|
2416
|
+
|
2417
|
+
[String] value - the value to match exactly
|
2418
|
+
|
2419
|
+
__Returns:__
|
2420
|
+
|
2421
|
+
[Array<EditText>]
|
2422
|
+
|
2423
|
+
--
|
2424
|
+
|
2425
|
+
##### [value](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/patch.rb#L12)
|
2426
|
+
|
2427
|
+
> def value
|
2428
|
+
|
2429
|
+
Returns the value attribute
|
2430
|
+
|
2431
|
+
Fixes NoMethodError: undefined method `value' for Selenium::WebDriver::Element
|
2432
|
+
|
2433
|
+
--
|
2434
|
+
|
2435
|
+
##### [name](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/patch.rb#L19)
|
2436
|
+
|
2437
|
+
> def name
|
2438
|
+
|
2439
|
+
Returns the name attribute
|
2440
|
+
|
2441
|
+
Fixes NoMethodError: undefined method `name' for Selenium::WebDriver::Element
|
2442
|
+
|
2443
|
+
--
|
2444
|
+
|
2445
|
+
##### [location_rel](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/patch.rb#L31)
|
2446
|
+
|
2447
|
+
> def location_rel
|
2448
|
+
|
2449
|
+
For use with mobile tap.
|
2450
|
+
|
2451
|
+
```ruby
|
2452
|
+
execute_script 'mobile: tap', :x => 0.0, :y => 0.98
|
2453
|
+
```
|
2454
|
+
|
2455
|
+
https://github.com/appium/appium/wiki/Automating-mobile-gestures
|
2456
|
+
|
2457
|
+
__Returns:__
|
2458
|
+
|
2459
|
+
[OpenStruct] the relative x, y in a struct. ex: { x: 0.50, y: 0.20 }
|
2460
|
+
|
2461
|
+
--
|
2462
|
+
|
2463
|
+
##### [DEFAULT_HEADERS](https://github.com/appium/ruby_lib/blob/ad91ee47a96bf7a19b6f784dc760ac70b8788e5a/lib/appium_lib/common/patch.rb#L147)
|
2464
|
+
|
2465
|
+
> DEFAULT_HEADERS = { 'Accept' => CONTENT_TYPE, 'User-Agent' => "appium/ruby_lib/#{::Appium::VERSION}" }
|
2466
|
+
|
2467
|
+
|
2468
|
+
|
2469
|
+
--
|
2470
|
+
|