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
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjIzMWRjODRkYzk3YmExNDQ4OWRkOTdhMDU4MGE2ODQ0Zjk2NjBkYg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YmQyMDMyOTZkYjc0NDFiZWEzNTRkNmI2ODM4YjFkNzdkOTM1ODQyMA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NGYzYWEwNDlkMGJmNGM1NTcyYjE3NjRhNjYzODdhN2I3Y2RkNjY3YzQ4NDAz
|
10
|
+
YjAxZWQ0NWRiZjg4NTAzMjMyYTMzYTJkMzA3ZjAyMmI2ZDM5MzM1ZTIzZjM2
|
11
|
+
NzMyMWQ0NzE5NWI3ZDA5M2IzNjNmM2Y0OTg0MDQ3OTAxZjY4Mzc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZDE1NmE2ZjY5ZDhkMzBmMjQ4ZTU2NTA0NDY5NjA2NzVjMjQ0MzQ2MmEwMDBk
|
14
|
+
MGE1YzIzYWRhZDc4YWY5MjA5YmZlN2RjY2NiMDkyMDRhNjdlOGQ1ZjljMGQ1
|
15
|
+
ZjE3ZGRlOTg2MDkzOTAxYzg1OGVkZTJiOWRiM2UzZmY3ZWE0YWY=
|
data/Rakefile
CHANGED
@@ -93,15 +93,29 @@ task :install => [ :gem, :uninstall ] do
|
|
93
93
|
sh "gem install --no-rdoc --no-ri --local #{repo_name}-#{version}.gem"
|
94
94
|
end
|
95
95
|
|
96
|
+
desc 'Update android and iOS docs'
|
97
|
+
task :docs do
|
98
|
+
sh "ruby docs_gen/make_docs.rb"
|
99
|
+
end
|
100
|
+
|
96
101
|
desc 'Update release notes'
|
97
102
|
task :notes do
|
103
|
+
tag_sort = ->(tag1,tag2) do
|
104
|
+
tag1_numbers = tag1.match(/\.?v(\d+\.\d+\.\d+)$/)[1].split('.').map! { |n| n.to_i }
|
105
|
+
tag2_numbers = tag2.match(/\.?v(\d+\.\d+\.\d+)$/)[1].split('.').map! { |n| n.to_i }
|
106
|
+
tag1_numbers <=> tag2_numbers
|
107
|
+
end
|
108
|
+
|
98
109
|
tags = `git tag`.split "\n"
|
110
|
+
tags.sort! &tag_sort
|
99
111
|
pairs = []
|
100
112
|
tags.each_index { |a| pairs.push tags[a] + '...' + tags[a+1] unless tags[a+1].nil? }
|
101
113
|
|
102
114
|
notes = ''
|
103
115
|
|
104
116
|
dates = `git log --tags --simplify-by-decoration --pretty="format:%d %ad" --date=short`.split "\n"
|
117
|
+
|
118
|
+
pairs.sort! &tag_sort
|
105
119
|
pairs.reverse! # pairs are in reverse order.
|
106
120
|
|
107
121
|
tag_date = []
|
@@ -122,7 +136,9 @@ task :notes do
|
|
122
136
|
data.split("\n").each do |line|
|
123
137
|
hex = line.match(/[a-zA-Z0-9]+/)[0]
|
124
138
|
# use first 7 chars to match GitHub
|
125
|
-
|
139
|
+
comment = line.gsub(hex, '').strip
|
140
|
+
next if comment == 'Update release notes'
|
141
|
+
new_data += "- [#{hex[0...7]}](https://github.com/appium/#{gh_name}/commit/#{hex}) #{comment}\n"
|
126
142
|
end
|
127
143
|
data = new_data + "\n"
|
128
144
|
|
@@ -0,0 +1,1328 @@
|
|
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
|
+
##### [tag_name_to_android](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/android/helper.rb#L6) android
|
937
|
+
|
938
|
+
> def tag_name_to_android tag_name
|
939
|
+
|
940
|
+
Returns an array of android classes that match the tag name
|
941
|
+
|
942
|
+
__Parameters:__
|
943
|
+
|
944
|
+
[String] tag_name - the tag name to convert to an android class
|
945
|
+
|
946
|
+
__Returns:__
|
947
|
+
|
948
|
+
[String]
|
949
|
+
|
950
|
+
--
|
951
|
+
|
952
|
+
##### [find_eles_attr](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/android/helper.rb#L44) android
|
953
|
+
|
954
|
+
> def find_eles_attr tag_name
|
955
|
+
|
956
|
+
Find all elements matching the attribute
|
957
|
+
On android, assume the attr is name (which falls back to text).
|
958
|
+
|
959
|
+
__Parameters:__
|
960
|
+
|
961
|
+
[String] tag_name - the tag name to search for
|
962
|
+
|
963
|
+
__Returns:__
|
964
|
+
|
965
|
+
[Element]
|
966
|
+
|
967
|
+
--
|
968
|
+
|
969
|
+
##### [get_selendroid_inspect](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/android/helper.rb#L66) android
|
970
|
+
|
971
|
+
> def get_selendroid_inspect
|
972
|
+
|
973
|
+
Selendroid only.
|
974
|
+
Returns a string containing interesting elements.
|
975
|
+
|
976
|
+
__Returns:__
|
977
|
+
|
978
|
+
[String]
|
979
|
+
|
980
|
+
--
|
981
|
+
|
982
|
+
##### [get_android_inspect](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/android/helper.rb#L131) android
|
983
|
+
|
984
|
+
> def get_android_inspect
|
985
|
+
|
986
|
+
Android only.
|
987
|
+
Returns a string containing interesting elements.
|
988
|
+
|
989
|
+
__Returns:__
|
990
|
+
|
991
|
+
[String]
|
992
|
+
|
993
|
+
--
|
994
|
+
|
995
|
+
##### [get_inspect](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/android/helper.rb#L180) android
|
996
|
+
|
997
|
+
> def get_inspect
|
998
|
+
|
999
|
+
Automatically detects selendroid or android.
|
1000
|
+
Returns a string containing interesting elements.
|
1001
|
+
|
1002
|
+
__Returns:__
|
1003
|
+
|
1004
|
+
[String]
|
1005
|
+
|
1006
|
+
--
|
1007
|
+
|
1008
|
+
##### [page](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/android/helper.rb#L186) android
|
1009
|
+
|
1010
|
+
> def page
|
1011
|
+
|
1012
|
+
Intended for use with console.
|
1013
|
+
Inspects and prints the current page.
|
1014
|
+
|
1015
|
+
--
|
1016
|
+
|
1017
|
+
##### [fast_duration](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/android/helper.rb#L199) android
|
1018
|
+
|
1019
|
+
> def fast_duration
|
1020
|
+
|
1021
|
+
JavaScript code from https://github.com/appium/appium/blob/master/app/android.js
|
1022
|
+
|
1023
|
+
```javascript
|
1024
|
+
Math.round((duration * 1000) / 200)
|
1025
|
+
(.20 * 1000) / 200 = 1
|
1026
|
+
```
|
1027
|
+
|
1028
|
+
We want steps to be exactly 1. If it's zero then a tap is used instead of a swipe.
|
1029
|
+
|
1030
|
+
--
|
1031
|
+
|
1032
|
+
##### [alert_click](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/android/element/alert.rb#L6) android
|
1033
|
+
|
1034
|
+
> def alert_click value
|
1035
|
+
|
1036
|
+
Tap the alert button identified by value.
|
1037
|
+
|
1038
|
+
__Parameters:__
|
1039
|
+
|
1040
|
+
[Integer, String] value - either an integer index of the button or the button's name
|
1041
|
+
|
1042
|
+
__Returns:__
|
1043
|
+
|
1044
|
+
[void]
|
1045
|
+
|
1046
|
+
--
|
1047
|
+
|
1048
|
+
##### [alert_accept](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/android/element/alert.rb#L13) android
|
1049
|
+
|
1050
|
+
> def alert_accept
|
1051
|
+
|
1052
|
+
Accept the alert.
|
1053
|
+
The last button is considered "accept."
|
1054
|
+
|
1055
|
+
__Returns:__
|
1056
|
+
|
1057
|
+
[void]
|
1058
|
+
|
1059
|
+
--
|
1060
|
+
|
1061
|
+
##### [alert_accept_text](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/android/element/alert.rb#L20) android
|
1062
|
+
|
1063
|
+
> def alert_accept_text
|
1064
|
+
|
1065
|
+
Get the text of the alert's accept button.
|
1066
|
+
The last button is considered "accept."
|
1067
|
+
|
1068
|
+
__Returns:__
|
1069
|
+
|
1070
|
+
[String]
|
1071
|
+
|
1072
|
+
--
|
1073
|
+
|
1074
|
+
##### [alert_dismiss](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/android/element/alert.rb#L27) android
|
1075
|
+
|
1076
|
+
> def alert_dismiss
|
1077
|
+
|
1078
|
+
Dismiss the alert.
|
1079
|
+
The first button is considered "dismiss."
|
1080
|
+
|
1081
|
+
__Returns:__
|
1082
|
+
|
1083
|
+
[void]
|
1084
|
+
|
1085
|
+
--
|
1086
|
+
|
1087
|
+
##### [alert_dismiss_text](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/android/element/alert.rb#L34) android
|
1088
|
+
|
1089
|
+
> def alert_dismiss_text
|
1090
|
+
|
1091
|
+
Get the text of the alert's dismiss button.
|
1092
|
+
The first button is considered "dismiss."
|
1093
|
+
|
1094
|
+
__Returns:__
|
1095
|
+
|
1096
|
+
[String]
|
1097
|
+
|
1098
|
+
--
|
1099
|
+
|
1100
|
+
##### [find](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/android/element/generic.rb#L44) android
|
1101
|
+
|
1102
|
+
> def find val
|
1103
|
+
|
1104
|
+
Find the value contained in content description or text. Search elements
|
1105
|
+
in this order: EditText, Button, ImageButton
|
1106
|
+
|
1107
|
+
__Parameters:__
|
1108
|
+
|
1109
|
+
[String] val - the value to search for
|
1110
|
+
|
1111
|
+
__Returns:__
|
1112
|
+
|
1113
|
+
[Element]
|
1114
|
+
|
1115
|
+
--
|
1116
|
+
|
1117
|
+
##### [text](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/android/element/generic.rb#L70) android
|
1118
|
+
|
1119
|
+
> def text text
|
1120
|
+
|
1121
|
+
Return the first element matching text.
|
1122
|
+
|
1123
|
+
__Parameters:__
|
1124
|
+
|
1125
|
+
[String] text - the text to search for
|
1126
|
+
|
1127
|
+
__Returns:__
|
1128
|
+
|
1129
|
+
[Element] the first matching element
|
1130
|
+
|
1131
|
+
--
|
1132
|
+
|
1133
|
+
##### [texts](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/android/element/generic.rb#L79) android
|
1134
|
+
|
1135
|
+
> def texts text
|
1136
|
+
|
1137
|
+
Return all elements matching text.
|
1138
|
+
|
1139
|
+
__Parameters:__
|
1140
|
+
|
1141
|
+
[String] text - the text to search for
|
1142
|
+
|
1143
|
+
__Returns:__
|
1144
|
+
|
1145
|
+
[Array<Element>] all matching elements
|
1146
|
+
|
1147
|
+
--
|
1148
|
+
|
1149
|
+
##### [name](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/android/element/generic.rb#L88) android
|
1150
|
+
|
1151
|
+
> def name name
|
1152
|
+
|
1153
|
+
Return the first element matching name.
|
1154
|
+
on Android name is content description
|
1155
|
+
on iOS name is the accessibility label or the text.
|
1156
|
+
|
1157
|
+
__Parameters:__
|
1158
|
+
|
1159
|
+
[String] name - the name to search for
|
1160
|
+
|
1161
|
+
__Returns:__
|
1162
|
+
|
1163
|
+
[Element] the first matching element
|
1164
|
+
|
1165
|
+
--
|
1166
|
+
|
1167
|
+
##### [names](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/android/element/generic.rb#L99) android
|
1168
|
+
|
1169
|
+
> def names name
|
1170
|
+
|
1171
|
+
Return all elements matching name.
|
1172
|
+
on Android name is content description
|
1173
|
+
on iOS name is the accessibility label or the text.
|
1174
|
+
|
1175
|
+
__Parameters:__
|
1176
|
+
|
1177
|
+
[String] name - the name to search for
|
1178
|
+
|
1179
|
+
__Returns:__
|
1180
|
+
|
1181
|
+
[Array<Element>] all matching elements
|
1182
|
+
|
1183
|
+
--
|
1184
|
+
|
1185
|
+
##### [scroll_to](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/android/element/generic.rb#L106) android
|
1186
|
+
|
1187
|
+
> def scroll_to text
|
1188
|
+
|
1189
|
+
Scroll to an element containing target text or description.
|
1190
|
+
|
1191
|
+
__Parameters:__
|
1192
|
+
|
1193
|
+
[String] text - the text to search for in the text value and content description
|
1194
|
+
|
1195
|
+
__Returns:__
|
1196
|
+
|
1197
|
+
[Element] the element scrolled to
|
1198
|
+
|
1199
|
+
--
|
1200
|
+
|
1201
|
+
##### [textfields](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/android/element/textfield.rb#L7) android
|
1202
|
+
|
1203
|
+
> def textfields
|
1204
|
+
|
1205
|
+
Get an array of textfield texts.
|
1206
|
+
|
1207
|
+
__Returns:__
|
1208
|
+
|
1209
|
+
[Array<String>]
|
1210
|
+
|
1211
|
+
--
|
1212
|
+
|
1213
|
+
##### [e_textfields](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/android/element/textfield.rb#L13) android
|
1214
|
+
|
1215
|
+
> def e_textfields
|
1216
|
+
|
1217
|
+
Get an array of textfield elements.
|
1218
|
+
|
1219
|
+
__Returns:__
|
1220
|
+
|
1221
|
+
[Array<Textfield>]
|
1222
|
+
|
1223
|
+
--
|
1224
|
+
|
1225
|
+
##### [first_textfield](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/android/element/textfield.rb#L19) android
|
1226
|
+
|
1227
|
+
> def first_textfield
|
1228
|
+
|
1229
|
+
Get the first textfield element.
|
1230
|
+
|
1231
|
+
__Returns:__
|
1232
|
+
|
1233
|
+
[Textfield]
|
1234
|
+
|
1235
|
+
--
|
1236
|
+
|
1237
|
+
##### [last_textfield](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/android/element/textfield.rb#L25) android
|
1238
|
+
|
1239
|
+
> def last_textfield
|
1240
|
+
|
1241
|
+
Get the last textfield element.
|
1242
|
+
|
1243
|
+
__Returns:__
|
1244
|
+
|
1245
|
+
[Textfield]
|
1246
|
+
|
1247
|
+
--
|
1248
|
+
|
1249
|
+
##### [textfield](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/android/element/textfield.rb#L32) android
|
1250
|
+
|
1251
|
+
> def textfield text
|
1252
|
+
|
1253
|
+
Get the first textfield that includes text or name (content description).
|
1254
|
+
|
1255
|
+
__Parameters:__
|
1256
|
+
|
1257
|
+
[String, Integer] text - the text to search for. If int then the textfield at that index is returned.
|
1258
|
+
|
1259
|
+
__Returns:__
|
1260
|
+
|
1261
|
+
[Textfield]
|
1262
|
+
|
1263
|
+
--
|
1264
|
+
|
1265
|
+
##### [textfield_exact](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/android/element/textfield.rb#L45) android
|
1266
|
+
|
1267
|
+
> def textfield_exact text
|
1268
|
+
|
1269
|
+
Get the first textfield that matches text.
|
1270
|
+
|
1271
|
+
__Parameters:__
|
1272
|
+
|
1273
|
+
[String] text - the text to match
|
1274
|
+
|
1275
|
+
__Returns:__
|
1276
|
+
|
1277
|
+
[Textfield]
|
1278
|
+
|
1279
|
+
--
|
1280
|
+
|
1281
|
+
##### [value](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/patch.rb#L10)
|
1282
|
+
|
1283
|
+
> def value
|
1284
|
+
|
1285
|
+
Returns the value attribute
|
1286
|
+
|
1287
|
+
Fixes NoMethodError: undefined method `value' for Selenium::WebDriver::Element
|
1288
|
+
|
1289
|
+
--
|
1290
|
+
|
1291
|
+
##### [name](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/patch.rb#L17)
|
1292
|
+
|
1293
|
+
> def name
|
1294
|
+
|
1295
|
+
Returns the name attribute
|
1296
|
+
|
1297
|
+
Fixes NoMethodError: undefined method `name' for Selenium::WebDriver::Element
|
1298
|
+
|
1299
|
+
--
|
1300
|
+
|
1301
|
+
##### [tag_name](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/patch.rb#L24)
|
1302
|
+
|
1303
|
+
> def tag_name
|
1304
|
+
|
1305
|
+
Returns the type attribute
|
1306
|
+
|
1307
|
+
Fixes Selenium::WebDriver::Error::UnknownError: Not yet implemented
|
1308
|
+
|
1309
|
+
--
|
1310
|
+
|
1311
|
+
##### [location_rel](https://github.com/appium/ruby_lib/blob/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30/lib/appium_lib/common/patch.rb#L36)
|
1312
|
+
|
1313
|
+
> def location_rel
|
1314
|
+
|
1315
|
+
For use with mobile tap.
|
1316
|
+
|
1317
|
+
```ruby
|
1318
|
+
execute_script 'mobile: tap', :x => 0.0, :y => 0.98
|
1319
|
+
```
|
1320
|
+
|
1321
|
+
https://github.com/appium/appium/wiki/Automating-mobile-gestures
|
1322
|
+
|
1323
|
+
__Returns:__
|
1324
|
+
|
1325
|
+
[OpenStruct] the relative x, y in a struct. ex: { x: 0.50, y: 0.20 }
|
1326
|
+
|
1327
|
+
--
|
1328
|
+
|