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