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