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