appium_lib 0.24.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +17 -8
- data/android_tests/Gemfile +1 -0
- data/android_tests/LICENSE-2.0.txt +202 -0
- data/android_tests/Rakefile +61 -0
- data/android_tests/api.apk +0 -0
- data/android_tests/appium.txt +3 -0
- data/android_tests/flaky.txt +1 -0
- data/android_tests/lib/android/specs/android/dynamic.rb +5 -0
- data/android_tests/lib/android/specs/android/element/alert.rb +41 -0
- data/android_tests/lib/android/specs/android/element/button.rb +55 -0
- data/android_tests/lib/android/specs/android/element/generic.rb +48 -0
- data/android_tests/lib/android/specs/android/element/text.rb +39 -0
- data/android_tests/lib/android/specs/android/element/textfield.rb +60 -0
- data/android_tests/lib/android/specs/android/helper.rb +80 -0
- data/android_tests/lib/android/specs/android/patch.rb +14 -0
- data/android_tests/lib/android/specs/common/device.rb +117 -0
- data/android_tests/lib/android/specs/common/element/window.rb +9 -0
- data/android_tests/lib/android/specs/common/helper.rb +112 -0
- data/android_tests/lib/android/specs/common/patch.rb +69 -0
- data/android_tests/lib/android/specs/common/version.rb +9 -0
- data/android_tests/lib/android/specs/driver.rb +174 -0
- data/android_tests/lib/format.rb +49 -0
- data/android_tests/lib/run.rb +72 -0
- data/android_tests/readme.md +27 -0
- data/appium_lib.gemspec +8 -5
- data/docs/android_docs.md +1052 -716
- data/docs/ios_docs.md +657 -834
- data/docs_gen/make_docs.rb +1 -3
- data/ios_tests/Gemfile +1 -0
- data/ios_tests/LICENSE-2.0.txt +202 -0
- data/ios_tests/Rakefile +47 -0
- data/ios_tests/UICatalog.app.zip +0 -0
- data/ios_tests/UICatalog.app/12-6AM.png +0 -0
- data/ios_tests/UICatalog.app/12-6PM.png +0 -0
- data/ios_tests/UICatalog.app/6-12AM.png +0 -0
- data/ios_tests/UICatalog.app/6-12PM.png +0 -0
- data/ios_tests/UICatalog.app/Default-568h@2x.png +0 -0
- data/ios_tests/UICatalog.app/Default@2x.png +0 -0
- data/ios_tests/UICatalog.app/Info.plist +0 -0
- data/ios_tests/UICatalog.app/PkgInfo +1 -0
- data/ios_tests/UICatalog.app/UIButton_custom.png +0 -0
- data/ios_tests/UICatalog.app/UICatalog +0 -0
- data/ios_tests/UICatalog.app/blueButton.png +0 -0
- data/ios_tests/UICatalog.app/bookmarkImage.png +0 -0
- data/ios_tests/UICatalog.app/bookmarkImageHighlighted.png +0 -0
- data/ios_tests/UICatalog.app/divider.png +0 -0
- data/ios_tests/UICatalog.app/en.lproj/AlertsViewController.nib +0 -0
- data/ios_tests/UICatalog.app/en.lproj/ButtonsViewController.nib +0 -0
- data/ios_tests/UICatalog.app/en.lproj/ControlsViewController.nib +0 -0
- data/ios_tests/UICatalog.app/en.lproj/ImagesViewController.nib +0 -0
- data/ios_tests/UICatalog.app/en.lproj/Localizable.strings +0 -0
- data/ios_tests/UICatalog.app/en.lproj/MainWindow.nib +0 -0
- data/ios_tests/UICatalog.app/en.lproj/PickerViewController.nib +0 -0
- data/ios_tests/UICatalog.app/en.lproj/SearchBarController.nib +0 -0
- data/ios_tests/UICatalog.app/en.lproj/SegmentViewController.nib +0 -0
- data/ios_tests/UICatalog.app/en.lproj/TextFieldController.nib +0 -0
- data/ios_tests/UICatalog.app/en.lproj/TextViewController.nib +0 -0
- data/ios_tests/UICatalog.app/en.lproj/ToolbarViewController.nib +0 -0
- data/ios_tests/UICatalog.app/en.lproj/TransitionViewController.nib +0 -0
- data/ios_tests/UICatalog.app/en.lproj/WebViewController.nib +0 -0
- data/ios_tests/UICatalog.app/orangeslide.png +0 -0
- data/ios_tests/UICatalog.app/scene1.jpg +0 -0
- data/ios_tests/UICatalog.app/scene2.jpg +0 -0
- data/ios_tests/UICatalog.app/scene3.jpg +0 -0
- data/ios_tests/UICatalog.app/scene4.jpg +0 -0
- data/ios_tests/UICatalog.app/scene5.jpg +0 -0
- data/ios_tests/UICatalog.app/searchBarBackground.png +0 -0
- data/ios_tests/UICatalog.app/segment_check.png +0 -0
- data/ios_tests/UICatalog.app/segment_search.png +0 -0
- data/ios_tests/UICatalog.app/segment_tools.png +0 -0
- data/ios_tests/UICatalog.app/segmentedBackground.png +0 -0
- data/ios_tests/UICatalog.app/slider_ball.png +0 -0
- data/ios_tests/UICatalog.app/toolbarBackground.png +0 -0
- data/ios_tests/UICatalog.app/whiteButton.png +0 -0
- data/ios_tests/UICatalog.app/yellowslide.png +0 -0
- data/ios_tests/appium.txt +3 -0
- data/ios_tests/flaky.txt +1 -0
- data/ios_tests/lib/format.rb +25 -0
- data/ios_tests/lib/ios/specs/common/element/window.rb +15 -0
- data/ios_tests/lib/ios/specs/common/helper.rb +204 -0
- data/ios_tests/lib/ios/specs/common/patch.rb +50 -0
- data/ios_tests/lib/ios/specs/common/version.rb +17 -0
- data/ios_tests/lib/ios/specs/device/device.rb +82 -0
- data/ios_tests/lib/ios/specs/device/multi_touch.rb +12 -0
- data/ios_tests/lib/ios/specs/device/touch_actions.rb +15 -0
- data/ios_tests/lib/ios/specs/driver.rb +203 -0
- data/ios_tests/lib/ios/specs/ios/element/alert.rb +48 -0
- data/ios_tests/lib/ios/specs/ios/element/button.rb +58 -0
- data/ios_tests/lib/ios/specs/ios/element/generic.rb +35 -0
- data/ios_tests/lib/ios/specs/ios/element/text.rb +54 -0
- data/ios_tests/lib/ios/specs/ios/element/textfield.rb +123 -0
- data/ios_tests/lib/ios/specs/ios/helper.rb +27 -0
- data/ios_tests/lib/ios/specs/ios/patch.rb +30 -0
- data/ios_tests/lib/run.rb +106 -0
- data/ios_tests/readme.md +30 -0
- data/ios_tests/upload/sauce_storage.rb +64 -0
- data/ios_tests/upload/upload.rb +6 -0
- data/lib/appium_lib.rb +4 -14
- data/lib/appium_lib/android/dynamic.rb +30 -32
- data/lib/appium_lib/android/element/alert.rb +34 -33
- data/lib/appium_lib/android/element/button.rb +91 -0
- data/lib/appium_lib/android/element/generic.rb +51 -146
- data/lib/appium_lib/android/element/text.rb +54 -0
- data/lib/appium_lib/android/element/textfield.rb +46 -41
- data/lib/appium_lib/android/helper.rb +248 -417
- data/lib/appium_lib/android/mobile_methods.rb +17 -0
- data/lib/appium_lib/android/patch.rb +9 -8
- data/lib/appium_lib/awesome_print/ostruct.rb +33 -0
- data/lib/appium_lib/common/element/window.rb +9 -8
- data/lib/appium_lib/common/helper.rb +182 -243
- data/lib/appium_lib/common/patch.rb +65 -79
- data/lib/appium_lib/common/version.rb +2 -3
- data/lib/appium_lib/device/device.rb +339 -0
- data/lib/appium_lib/device/multi_touch.rb +94 -0
- data/lib/appium_lib/device/touch_actions.rb +142 -0
- data/lib/appium_lib/driver.rb +217 -306
- data/lib/appium_lib/ios/element/alert.rb +16 -92
- data/lib/appium_lib/ios/element/button.rb +55 -0
- data/lib/appium_lib/ios/element/generic.rb +27 -160
- data/lib/appium_lib/ios/element/text.rb +54 -0
- data/lib/appium_lib/ios/element/textfield.rb +78 -65
- data/lib/appium_lib/ios/helper.rb +300 -190
- data/lib/appium_lib/ios/mobile_methods.rb +17 -0
- data/lib/appium_lib/ios/patch.rb +55 -41
- data/lib/appium_lib/logger.rb +13 -0
- data/lib/appium_lib/rails/duplicable.rb +116 -0
- data/readme.md +6 -1
- data/release_notes.md +118 -0
- metadata +170 -12
- data/lib/appium_lib/common/element/button.rb +0 -83
- data/lib/appium_lib/common/element/text.rb +0 -61
data/docs/ios_docs.md
CHANGED
|
@@ -1,349 +1,375 @@
|
|
|
1
|
-
##### [
|
|
1
|
+
##### [load_appium_txt](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L71)
|
|
2
2
|
|
|
3
|
-
> def
|
|
3
|
+
> def self.load_appium_txt opts={}
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
Load appium.txt (toml format)
|
|
6
|
+
the basedir of this file + appium.txt is what's used
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
[caps]
|
|
10
|
+
app = "path/to/app"
|
|
11
|
+
|
|
12
|
+
[appium_lib]
|
|
13
|
+
port = 8080
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
:app is expanded
|
|
17
|
+
:require is expanded
|
|
18
|
+
all keys are converted to symbols
|
|
7
19
|
|
|
8
20
|
__Parameters:__
|
|
9
21
|
|
|
10
|
-
[
|
|
22
|
+
[Hash] opts - file: '/path/to/appium.txt', verbose: true
|
|
11
23
|
|
|
12
24
|
__Returns:__
|
|
13
25
|
|
|
14
|
-
[
|
|
26
|
+
[hash] the symbolized hash with updated :app and :require keys
|
|
15
27
|
|
|
16
28
|
--
|
|
17
29
|
|
|
18
|
-
##### [
|
|
30
|
+
##### [symbolize_keys](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L141)
|
|
19
31
|
|
|
20
|
-
> def
|
|
32
|
+
> def self.symbolize_keys hash
|
|
21
33
|
|
|
34
|
+
convert all keys (including nested) to symbols
|
|
22
35
|
|
|
36
|
+
based on deep_symbolize_keys & deep_transform_keys from rails
|
|
37
|
+
https://github.com/rails/docrails/blob/a3b1105ada3da64acfa3843b164b14b734456a50/activesupport/lib/active_support/core_ext/hash/keys.rb#L84
|
|
23
38
|
|
|
24
39
|
--
|
|
25
40
|
|
|
26
|
-
##### [
|
|
41
|
+
##### [promote_singleton_appium_methods](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L151)
|
|
27
42
|
|
|
28
|
-
> def
|
|
29
|
-
|
|
30
|
-
Get an array of text elements.
|
|
43
|
+
> def self.promote_singleton_appium_methods main_module
|
|
31
44
|
|
|
32
|
-
__Returns:__
|
|
33
45
|
|
|
34
|
-
[Array<Text>]
|
|
35
46
|
|
|
36
47
|
--
|
|
37
48
|
|
|
38
|
-
##### [
|
|
49
|
+
##### [promote_appium_methods](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L180)
|
|
39
50
|
|
|
40
|
-
> def
|
|
51
|
+
> def self.promote_appium_methods class_array
|
|
41
52
|
|
|
42
|
-
|
|
53
|
+
Promote appium methods to class instance methods
|
|
43
54
|
|
|
44
|
-
|
|
55
|
+
To promote methods to all classes:
|
|
45
56
|
|
|
46
|
-
|
|
57
|
+
```ruby
|
|
58
|
+
Appium.promote_appium_methods Object
|
|
59
|
+
```
|
|
47
60
|
|
|
48
|
-
|
|
61
|
+
__Parameters:__
|
|
49
62
|
|
|
50
|
-
|
|
63
|
+
[Array<Class>] class_array - An array of classes
|
|
51
64
|
|
|
52
|
-
|
|
65
|
+
--
|
|
53
66
|
|
|
54
|
-
|
|
67
|
+
##### [global_webdriver_http_sleep](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L213)
|
|
55
68
|
|
|
56
|
-
|
|
69
|
+
> def global_webdriver_http_sleep
|
|
57
70
|
|
|
58
|
-
|
|
71
|
+
The amount to sleep in seconds before every webdriver http call.
|
|
59
72
|
|
|
60
73
|
--
|
|
61
74
|
|
|
62
|
-
##### [
|
|
75
|
+
##### [global_webdriver_http_sleep=](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L213)
|
|
63
76
|
|
|
64
|
-
> def
|
|
77
|
+
> def global_webdriver_http_sleep=(value)
|
|
65
78
|
|
|
66
|
-
|
|
79
|
+
The amount to sleep in seconds before every webdriver http call.
|
|
67
80
|
|
|
68
|
-
|
|
81
|
+
--
|
|
69
82
|
|
|
70
|
-
|
|
83
|
+
##### [initialize](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L234)
|
|
71
84
|
|
|
72
|
-
|
|
85
|
+
> def initialize opts={}
|
|
73
86
|
|
|
74
|
-
|
|
87
|
+
Creates a new driver
|
|
75
88
|
|
|
76
|
-
|
|
89
|
+
```ruby
|
|
90
|
+
require 'rubygems'
|
|
91
|
+
require 'appium_lib'
|
|
77
92
|
|
|
78
|
-
|
|
93
|
+
# platformName takes a string or a symbol.
|
|
79
94
|
|
|
80
|
-
|
|
95
|
+
# Start iOS driver
|
|
96
|
+
opts = { caps: { platformName: :ios, app: '/path/to/MyiOS.app' } }
|
|
97
|
+
Appium::Driver.new(opts).start_driver
|
|
81
98
|
|
|
82
|
-
|
|
99
|
+
# Start Android driver
|
|
100
|
+
opts = { caps: { platformName: :android, app: '/path/to/my.apk' } }
|
|
101
|
+
Appium::Driver.new(apk).start_driver
|
|
102
|
+
```
|
|
83
103
|
|
|
84
104
|
__Parameters:__
|
|
85
105
|
|
|
86
|
-
[
|
|
106
|
+
[Object] opts - A hash containing various options.
|
|
87
107
|
|
|
88
108
|
__Returns:__
|
|
89
109
|
|
|
90
|
-
[
|
|
110
|
+
[Driver]
|
|
91
111
|
|
|
92
112
|
--
|
|
93
113
|
|
|
94
|
-
##### [
|
|
114
|
+
##### [driver_attributes](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L308)
|
|
95
115
|
|
|
96
|
-
> def
|
|
116
|
+
> def driver_attributes
|
|
97
117
|
|
|
98
|
-
|
|
118
|
+
Returns a hash of the driver attributes
|
|
119
|
+
|
|
120
|
+
--
|
|
121
|
+
|
|
122
|
+
##### [device_is_android?](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L328)
|
|
123
|
+
|
|
124
|
+
> def device_is_android?
|
|
99
125
|
|
|
100
|
-
__Parameters:__
|
|
101
126
|
|
|
102
|
-
[String] text - the text that the tag must match
|
|
103
127
|
|
|
104
128
|
__Returns:__
|
|
105
129
|
|
|
106
|
-
[
|
|
130
|
+
[Boolean]
|
|
107
131
|
|
|
108
132
|
--
|
|
109
133
|
|
|
110
|
-
##### [
|
|
134
|
+
##### [appium_server_version](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L344)
|
|
111
135
|
|
|
112
|
-
> def
|
|
136
|
+
> def appium_server_version
|
|
113
137
|
|
|
114
|
-
|
|
138
|
+
Returns the server's version info
|
|
115
139
|
|
|
116
|
-
|
|
140
|
+
```ruby
|
|
141
|
+
{
|
|
142
|
+
"build" => {
|
|
143
|
+
"version" => "0.18.1",
|
|
144
|
+
"revision" => "d242ebcfd92046a974347ccc3a28f0e898595198"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
```
|
|
117
148
|
|
|
118
|
-
|
|
149
|
+
__Returns:__
|
|
119
150
|
|
|
120
|
-
|
|
151
|
+
[Hash]
|
|
121
152
|
|
|
122
|
-
|
|
153
|
+
--
|
|
123
154
|
|
|
124
|
-
|
|
155
|
+
##### [absolute_app_path](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L350)
|
|
125
156
|
|
|
126
|
-
|
|
157
|
+
> def self.absolute_app_path app_path
|
|
127
158
|
|
|
128
|
-
|
|
159
|
+
Converts app_path to an absolute path.
|
|
129
160
|
|
|
130
161
|
__Returns:__
|
|
131
162
|
|
|
132
|
-
[
|
|
163
|
+
[String] APP_PATH as an absolute path
|
|
133
164
|
|
|
134
165
|
--
|
|
135
166
|
|
|
136
|
-
##### [
|
|
137
|
-
|
|
138
|
-
> def buttons text=nil
|
|
167
|
+
##### [server_url](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L374)
|
|
139
168
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
__Parameters:__
|
|
169
|
+
> def server_url
|
|
143
170
|
|
|
144
|
-
|
|
171
|
+
Get the server url
|
|
145
172
|
|
|
146
173
|
__Returns:__
|
|
147
174
|
|
|
148
|
-
[
|
|
175
|
+
[String] the server url
|
|
149
176
|
|
|
150
177
|
--
|
|
151
178
|
|
|
152
|
-
##### [
|
|
179
|
+
##### [restart](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L385)
|
|
153
180
|
|
|
154
|
-
> def
|
|
181
|
+
> def restart
|
|
155
182
|
|
|
156
|
-
|
|
183
|
+
Restarts the driver
|
|
157
184
|
|
|
158
185
|
__Returns:__
|
|
159
186
|
|
|
160
|
-
[
|
|
187
|
+
[Driver] the driver
|
|
161
188
|
|
|
162
189
|
--
|
|
163
190
|
|
|
164
|
-
##### [
|
|
191
|
+
##### [driver](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L392)
|
|
165
192
|
|
|
166
|
-
> def
|
|
193
|
+
> def driver
|
|
167
194
|
|
|
168
|
-
|
|
195
|
+
Returns the driver
|
|
169
196
|
|
|
170
197
|
__Returns:__
|
|
171
198
|
|
|
172
|
-
[
|
|
199
|
+
[Driver] the driver
|
|
173
200
|
|
|
174
201
|
--
|
|
175
202
|
|
|
176
|
-
##### [
|
|
203
|
+
##### [screenshot](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L402)
|
|
204
|
+
|
|
205
|
+
> def screenshot png_save_path
|
|
177
206
|
|
|
178
|
-
|
|
207
|
+
Takes a png screenshot and saves to the target path.
|
|
179
208
|
|
|
180
|
-
|
|
209
|
+
Example: screenshot '/tmp/hi.png'
|
|
181
210
|
|
|
182
211
|
__Parameters:__
|
|
183
212
|
|
|
184
|
-
[String]
|
|
213
|
+
[String] png_save_path - the full path to save the png
|
|
185
214
|
|
|
186
215
|
__Returns:__
|
|
187
216
|
|
|
188
|
-
[
|
|
217
|
+
[nil]
|
|
189
218
|
|
|
190
219
|
--
|
|
191
220
|
|
|
192
|
-
##### [
|
|
221
|
+
##### [driver_quit](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L409)
|
|
193
222
|
|
|
194
|
-
> def
|
|
195
|
-
|
|
196
|
-
Get all button elements that exactly match text.
|
|
197
|
-
|
|
198
|
-
__Parameters:__
|
|
223
|
+
> def driver_quit
|
|
199
224
|
|
|
200
|
-
|
|
225
|
+
Quits the driver
|
|
201
226
|
|
|
202
227
|
__Returns:__
|
|
203
228
|
|
|
204
|
-
[
|
|
229
|
+
[void]
|
|
205
230
|
|
|
206
231
|
--
|
|
207
232
|
|
|
208
|
-
##### [
|
|
233
|
+
##### [start_driver](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L417)
|
|
209
234
|
|
|
210
|
-
> def
|
|
235
|
+
> def start_driver
|
|
211
236
|
|
|
212
|
-
|
|
237
|
+
Creates a new global driver and quits the old one if it exists.
|
|
213
238
|
|
|
214
239
|
__Returns:__
|
|
215
240
|
|
|
216
|
-
[
|
|
241
|
+
[Selenium::WebDriver] the new global driver
|
|
217
242
|
|
|
218
243
|
--
|
|
219
244
|
|
|
220
|
-
##### [
|
|
245
|
+
##### [no_wait](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L443)
|
|
246
|
+
|
|
247
|
+
> def no_wait
|
|
248
|
+
|
|
249
|
+
Set implicit wait and default_wait to zero.
|
|
221
250
|
|
|
222
|
-
|
|
251
|
+
--
|
|
223
252
|
|
|
224
|
-
|
|
253
|
+
##### [set_wait](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L462)
|
|
225
254
|
|
|
226
|
-
|
|
227
|
-
occurrence. number=2 means the 2nd occurrence.
|
|
255
|
+
> def set_wait timeout=nil
|
|
228
256
|
|
|
229
|
-
|
|
257
|
+
Set implicit wait and default_wait to timeout, defaults to 30.
|
|
258
|
+
if set_wait is called without a param then the second to last
|
|
259
|
+
wait will be used.
|
|
230
260
|
|
|
231
|
-
|
|
261
|
+
```ruby`
|
|
262
|
+
set_wait 2
|
|
263
|
+
set_wait 3
|
|
264
|
+
set_wait # 2
|
|
232
265
|
|
|
233
|
-
|
|
234
|
-
so if there's no button found at number then
|
|
235
|
-
return the first button.
|
|
266
|
+
````
|
|
236
267
|
|
|
237
268
|
__Parameters:__
|
|
238
269
|
|
|
239
|
-
[
|
|
240
|
-
|
|
241
|
-
[Integer] number - the button occurance to return. 1 = first button
|
|
270
|
+
[Integer] timeout - the timeout in seconds
|
|
242
271
|
|
|
243
272
|
__Returns:__
|
|
244
273
|
|
|
245
|
-
[
|
|
274
|
+
[void]
|
|
246
275
|
|
|
247
276
|
--
|
|
248
277
|
|
|
249
|
-
##### [
|
|
250
|
-
|
|
251
|
-
> def find_eles_attr tag_name, attribute
|
|
278
|
+
##### [default_wait](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L480)
|
|
252
279
|
|
|
253
|
-
|
|
254
|
-
Get an array of attribute values from elements exactly matching tag name.
|
|
255
|
-
|
|
256
|
-
__Parameters:__
|
|
257
|
-
|
|
258
|
-
[String] tag_name - the tag name to find
|
|
280
|
+
> def default_wait
|
|
259
281
|
|
|
260
|
-
|
|
282
|
+
Returns the default client side wait.
|
|
283
|
+
This value is independent of what the server is using
|
|
261
284
|
|
|
262
285
|
__Returns:__
|
|
263
286
|
|
|
264
|
-
[
|
|
287
|
+
[Integer]
|
|
265
288
|
|
|
266
289
|
--
|
|
267
290
|
|
|
268
|
-
##### [
|
|
291
|
+
##### [exists](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L496)
|
|
292
|
+
|
|
293
|
+
> def exists pre_check=0, post_check=@default_wait, &search_block
|
|
294
|
+
|
|
295
|
+
Returns existence of element.
|
|
269
296
|
|
|
270
|
-
|
|
297
|
+
Example:
|
|
271
298
|
|
|
272
|
-
|
|
273
|
-
Get an array of attribute values from elements exactly matching tag name.
|
|
299
|
+
exists { button('sign in') } ? puts('true') : puts('false')
|
|
274
300
|
|
|
275
301
|
__Parameters:__
|
|
276
302
|
|
|
277
|
-
[
|
|
303
|
+
[Integer] pre_check - the amount in seconds to set the
|
|
304
|
+
wait to before checking existance
|
|
278
305
|
|
|
279
|
-
[
|
|
306
|
+
[Integer] post_check - the amount in seconds to set the
|
|
307
|
+
wait to after checking existance
|
|
280
308
|
|
|
281
|
-
[
|
|
309
|
+
[Block] search_block - the block to call
|
|
282
310
|
|
|
283
311
|
__Returns:__
|
|
284
312
|
|
|
285
|
-
[
|
|
313
|
+
[Boolean]
|
|
286
314
|
|
|
287
315
|
--
|
|
288
316
|
|
|
289
|
-
##### [
|
|
290
|
-
|
|
291
|
-
> def ios_password length=1
|
|
317
|
+
##### [execute_script](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L520)
|
|
292
318
|
|
|
293
|
-
|
|
319
|
+
> def execute_script script, *args
|
|
294
320
|
|
|
295
|
-
|
|
321
|
+
The same as @driver.execute_script
|
|
296
322
|
|
|
297
323
|
__Parameters:__
|
|
298
324
|
|
|
299
|
-
[
|
|
325
|
+
[String] script - the script to execute
|
|
326
|
+
|
|
327
|
+
[*args] args - the args to pass to the script
|
|
300
328
|
|
|
301
329
|
__Returns:__
|
|
302
330
|
|
|
303
|
-
[
|
|
331
|
+
[Object]
|
|
304
332
|
|
|
305
333
|
--
|
|
306
334
|
|
|
307
|
-
##### [
|
|
308
|
-
|
|
309
|
-
> def get_page_class
|
|
335
|
+
##### [find_elements](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L528)
|
|
310
336
|
|
|
311
|
-
|
|
337
|
+
> def find_elements *args
|
|
312
338
|
|
|
313
|
-
|
|
339
|
+
Calls @driver.find_elements
|
|
314
340
|
|
|
315
|
-
|
|
341
|
+
__Parameters:__
|
|
316
342
|
|
|
317
|
-
|
|
343
|
+
[*args] args - the args to use
|
|
318
344
|
|
|
345
|
+
__Returns:__
|
|
319
346
|
|
|
347
|
+
[Array<Element>] Array is empty when no elements are found.
|
|
320
348
|
|
|
321
349
|
--
|
|
322
350
|
|
|
323
|
-
##### [
|
|
324
|
-
|
|
325
|
-
> def get_page element=source_window(0)
|
|
351
|
+
##### [find_element](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L536)
|
|
326
352
|
|
|
327
|
-
|
|
353
|
+
> def find_element *args
|
|
328
354
|
|
|
329
|
-
|
|
330
|
-
use get_page(get_source) for all window sources
|
|
355
|
+
Calls @driver.find_elements
|
|
331
356
|
|
|
332
357
|
__Parameters:__
|
|
333
358
|
|
|
334
|
-
[
|
|
359
|
+
[*args] args - the args to use
|
|
335
360
|
|
|
336
361
|
__Returns:__
|
|
337
362
|
|
|
338
|
-
[
|
|
363
|
+
[Element]
|
|
339
364
|
|
|
340
365
|
--
|
|
341
366
|
|
|
342
|
-
##### [
|
|
367
|
+
##### [x](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L543)
|
|
343
368
|
|
|
344
|
-
> def
|
|
369
|
+
> def x
|
|
345
370
|
|
|
346
|
-
|
|
371
|
+
Quit the driver and Pry.
|
|
372
|
+
quit and exit are reserved by Pry.
|
|
347
373
|
|
|
348
374
|
__Returns:__
|
|
349
375
|
|
|
@@ -351,407 +377,474 @@ __Returns:__
|
|
|
351
377
|
|
|
352
378
|
--
|
|
353
379
|
|
|
354
|
-
##### [
|
|
380
|
+
##### [NoArgMethods](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L7)
|
|
355
381
|
|
|
356
|
-
>
|
|
382
|
+
> NoArgMethods = {
|
|
357
383
|
|
|
358
|
-
Gets the JSON source of window number
|
|
359
|
-
|
|
360
|
-
__Parameters:__
|
|
361
384
|
|
|
362
|
-
[Integer] window_number - the int index of the target window
|
|
363
385
|
|
|
364
|
-
|
|
386
|
+
--
|
|
365
387
|
|
|
366
|
-
|
|
388
|
+
##### [app_strings](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L23)
|
|
367
389
|
|
|
368
|
-
|
|
390
|
+
> def app_strings
|
|
369
391
|
|
|
370
|
-
|
|
392
|
+
Return the hash of all localization strings.
|
|
393
|
+
```ruby
|
|
394
|
+
app_strings #=> "TransitionsTitle"=>"Transitions", "WebTitle"=>"Web"
|
|
395
|
+
```
|
|
371
396
|
|
|
372
|
-
|
|
397
|
+
--
|
|
373
398
|
|
|
374
|
-
|
|
375
|
-
example: page_window 0
|
|
399
|
+
##### [background_app](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L29)
|
|
376
400
|
|
|
377
|
-
|
|
401
|
+
> def background_app
|
|
378
402
|
|
|
379
|
-
|
|
403
|
+
Backgrounds the app for a set number of seconds.
|
|
404
|
+
This is a blocking application
|
|
380
405
|
|
|
381
406
|
--
|
|
382
407
|
|
|
383
|
-
##### [
|
|
384
|
-
|
|
385
|
-
> def fast_duration
|
|
408
|
+
##### [current_activity](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L34)
|
|
386
409
|
|
|
387
|
-
|
|
410
|
+
> def current_activity
|
|
388
411
|
|
|
389
|
-
__Returns:__
|
|
390
412
|
|
|
391
|
-
[Float]
|
|
392
413
|
|
|
393
414
|
--
|
|
394
415
|
|
|
395
|
-
##### [
|
|
416
|
+
##### [launch](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L36)
|
|
396
417
|
|
|
397
|
-
> def
|
|
418
|
+
> def launch
|
|
398
419
|
|
|
399
|
-
|
|
420
|
+
Start the simulator and applicaton configured with desired capabilities
|
|
400
421
|
|
|
401
|
-
|
|
422
|
+
--
|
|
402
423
|
|
|
403
|
-
|
|
424
|
+
##### [reset](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L39)
|
|
404
425
|
|
|
405
|
-
|
|
426
|
+
> def reset
|
|
406
427
|
|
|
407
|
-
|
|
428
|
+
Reset the device, relaunching the application.
|
|
408
429
|
|
|
409
430
|
--
|
|
410
431
|
|
|
411
|
-
##### [
|
|
432
|
+
##### [shake](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L42)
|
|
412
433
|
|
|
413
|
-
> def
|
|
434
|
+
> def shake
|
|
414
435
|
|
|
415
|
-
|
|
436
|
+
Cause the device to shake
|
|
416
437
|
|
|
417
|
-
|
|
438
|
+
--
|
|
418
439
|
|
|
419
|
-
|
|
440
|
+
##### [toggle_flight_mode](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L45)
|
|
420
441
|
|
|
421
|
-
|
|
442
|
+
> def toggle_flight_mode
|
|
422
443
|
|
|
423
|
-
|
|
444
|
+
toggle flight mode on or off
|
|
424
445
|
|
|
425
|
-
|
|
446
|
+
--
|
|
426
447
|
|
|
427
|
-
|
|
428
|
-
Tap the alert button identified by value.
|
|
448
|
+
##### [complex_find](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L48)
|
|
429
449
|
|
|
430
|
-
|
|
431
|
-
alert_click 'OK'
|
|
450
|
+
> def complex_find
|
|
432
451
|
|
|
433
|
-
|
|
434
|
-
|
|
452
|
+
Find an element by a complex array of criteria. Available criteria
|
|
453
|
+
are listed in [link here]. Criteria are formed by creating an array
|
|
454
|
+
of arrays, each containing a selector and that selector's value.
|
|
435
455
|
|
|
436
|
-
|
|
456
|
+
```ruby
|
|
457
|
+
complex_find [[[2, 'Sau'], [14, true]]] # => Find a clickable element
|
|
458
|
+
# whose names starts with 'Sau'
|
|
459
|
+
```
|
|
437
460
|
|
|
438
|
-
|
|
461
|
+
__Parameters:__
|
|
439
462
|
|
|
440
|
-
|
|
463
|
+
[Symbol] mod - If present, will be the 0th element in the selector array.
|
|
441
464
|
|
|
442
|
-
[
|
|
465
|
+
[Array<Object>] selectors - The selectors to find elements with.
|
|
443
466
|
|
|
444
467
|
--
|
|
445
468
|
|
|
446
|
-
##### [
|
|
469
|
+
##### [hide_keyboard](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L60)
|
|
447
470
|
|
|
448
|
-
> def
|
|
471
|
+
> def hide_keyboard
|
|
449
472
|
|
|
450
|
-
|
|
473
|
+
Hide the onscreen keyboard
|
|
451
474
|
|
|
452
|
-
|
|
475
|
+
__Parameters:__
|
|
453
476
|
|
|
454
|
-
[String]
|
|
477
|
+
[String] close_key - the name of the key which closes the keyboard.
|
|
478
|
+
Defaults to 'Done'.
|
|
455
479
|
|
|
456
480
|
--
|
|
457
481
|
|
|
458
|
-
##### [
|
|
482
|
+
##### [key_event](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L69)
|
|
459
483
|
|
|
460
|
-
> def
|
|
484
|
+
> def key_event
|
|
461
485
|
|
|
462
|
-
|
|
486
|
+
Send a key event to the device.
|
|
463
487
|
|
|
464
|
-
|
|
488
|
+
__Parameters:__
|
|
465
489
|
|
|
466
|
-
[
|
|
490
|
+
[integer] key - The key to send.
|
|
491
|
+
|
|
492
|
+
[String] metastate - The state the metakeys should be in when sending the key.
|
|
467
493
|
|
|
468
494
|
--
|
|
469
495
|
|
|
470
|
-
##### [
|
|
496
|
+
##### [push_file](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L74)
|
|
471
497
|
|
|
472
|
-
> def
|
|
498
|
+
> def push_file
|
|
473
499
|
|
|
474
|
-
|
|
475
|
-
The last button is considered "accept." on iOS 6
|
|
476
|
-
The first button is considered "accept." on iOS 7
|
|
500
|
+
Place a file in a specific location on the device.
|
|
477
501
|
|
|
478
|
-
|
|
502
|
+
__Parameters:__
|
|
479
503
|
|
|
480
|
-
[String]
|
|
504
|
+
[String] path - The absolute path on the device to store data at.
|
|
505
|
+
|
|
506
|
+
[String] data - Raw file data to be sent to the device.
|
|
481
507
|
|
|
482
508
|
--
|
|
483
509
|
|
|
484
|
-
##### [
|
|
510
|
+
##### [pull_file](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L79)
|
|
485
511
|
|
|
486
|
-
> def
|
|
512
|
+
> def pull_file
|
|
487
513
|
|
|
488
|
-
|
|
514
|
+
Retrieve a file from the device. This can retrieve an absolute path or
|
|
515
|
+
a path relative to the installed app (iOS only).
|
|
516
|
+
```ruby
|
|
517
|
+
pull_file '/local/data/some/path' #=> Get the file at that path
|
|
518
|
+
pull_file 'Shenanigans.app/some/file' #=> Get 'some/file' from the install location of Shenanigans.app
|
|
519
|
+
```
|
|
489
520
|
|
|
490
|
-
|
|
521
|
+
__Parameters:__
|
|
491
522
|
|
|
492
|
-
[
|
|
523
|
+
[String] path - Either an absolute path OR, for iOS devices, a path relative to the app, as described.
|
|
493
524
|
|
|
494
525
|
--
|
|
495
526
|
|
|
496
|
-
##### [
|
|
497
|
-
|
|
498
|
-
> def alert_dismiss_text
|
|
527
|
+
##### [extend_search_contexts](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L277)
|
|
499
528
|
|
|
500
|
-
|
|
501
|
-
The first button is considered "dismiss." on iOS 6
|
|
502
|
-
The last button is considered "dismiss." on iOS 7
|
|
529
|
+
> def extend_search_contexts
|
|
503
530
|
|
|
504
|
-
__Returns:__
|
|
505
531
|
|
|
506
|
-
[String]
|
|
507
532
|
|
|
508
533
|
--
|
|
509
534
|
|
|
510
|
-
##### [
|
|
535
|
+
##### [accessiblity_id_find](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L277)
|
|
511
536
|
|
|
512
|
-
> def
|
|
537
|
+
> def accessiblity_id_find
|
|
513
538
|
|
|
514
|
-
|
|
539
|
+
find_element/s with their accessibility_id
|
|
515
540
|
|
|
516
|
-
|
|
541
|
+
```ruby
|
|
542
|
+
find_elements :accessibility_id, 'Animation'
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
--
|
|
517
546
|
|
|
518
|
-
|
|
547
|
+
##### [add_touch_actions](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L283)
|
|
548
|
+
|
|
549
|
+
> def add_touch_actions
|
|
519
550
|
|
|
520
|
-
__Returns:__
|
|
521
551
|
|
|
522
|
-
[Element] the first matching element
|
|
523
552
|
|
|
524
553
|
--
|
|
525
554
|
|
|
526
|
-
##### [
|
|
555
|
+
##### [current_context=](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L307)
|
|
527
556
|
|
|
528
|
-
> def
|
|
557
|
+
> def current_context=
|
|
529
558
|
|
|
530
|
-
|
|
559
|
+
Change the context to the given context.
|
|
560
|
+
```ruby
|
|
561
|
+
current_context= "NATIVE_APP"
|
|
562
|
+
```
|
|
531
563
|
|
|
532
564
|
__Parameters:__
|
|
533
565
|
|
|
534
|
-
[String]
|
|
566
|
+
[String] The - context to change to
|
|
567
|
+
|
|
568
|
+
--
|
|
569
|
+
|
|
570
|
+
##### [current_context](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L315)
|
|
571
|
+
|
|
572
|
+
> def current_context
|
|
573
|
+
|
|
574
|
+
|
|
535
575
|
|
|
536
576
|
__Returns:__
|
|
537
577
|
|
|
538
|
-
[
|
|
578
|
+
[String] The context currently being used.
|
|
539
579
|
|
|
540
580
|
--
|
|
541
581
|
|
|
542
|
-
##### [
|
|
543
|
-
|
|
544
|
-
> def text text
|
|
582
|
+
##### [available_contexts](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L318)
|
|
545
583
|
|
|
546
|
-
|
|
584
|
+
> def available_contexts
|
|
547
585
|
|
|
548
|
-
__Parameters:__
|
|
549
586
|
|
|
550
|
-
[String] text - the text to search for
|
|
551
587
|
|
|
552
588
|
__Returns:__
|
|
553
589
|
|
|
554
|
-
[
|
|
590
|
+
[Array<String>] All usable contexts, as an array of strings.
|
|
555
591
|
|
|
556
592
|
--
|
|
557
593
|
|
|
558
|
-
##### [
|
|
594
|
+
##### [within_context](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L328)
|
|
559
595
|
|
|
560
|
-
> def
|
|
596
|
+
> def within_context(context)
|
|
561
597
|
|
|
562
|
-
|
|
598
|
+
Perform a block within the given context, then switch back to the starting context.
|
|
599
|
+
```ruby
|
|
600
|
+
within_context('NATIVE_APP') do
|
|
601
|
+
find_element [:tag, "button"]
|
|
602
|
+
```
|
|
563
603
|
|
|
564
604
|
__Parameters:__
|
|
565
605
|
|
|
566
|
-
[String]
|
|
606
|
+
[String] context - The context to switch to for the duration of the block.
|
|
567
607
|
|
|
568
|
-
|
|
608
|
+
--
|
|
569
609
|
|
|
570
|
-
|
|
610
|
+
##### [switch_to_default_context](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L335)
|
|
571
611
|
|
|
572
|
-
|
|
612
|
+
> def switch_to_default_context
|
|
573
613
|
|
|
574
|
-
|
|
614
|
+
Change to the default context. This is equivalent to `current_context= nil`.
|
|
575
615
|
|
|
576
|
-
|
|
616
|
+
--
|
|
577
617
|
|
|
578
|
-
|
|
579
|
-
on Android name is content description
|
|
580
|
-
on iOS name is the accessibility label or the text.
|
|
618
|
+
##### [pinch](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/multi_touch.rb#L30)
|
|
581
619
|
|
|
582
|
-
|
|
583
|
-
# find element with name or label containing example and access the name attribute.
|
|
584
|
-
name('example').name
|
|
620
|
+
> def pinch(percentage=25, auto_perform=true)
|
|
585
621
|
|
|
586
|
-
|
|
587
|
-
|
|
622
|
+
Convenience method for pinching the screen.
|
|
623
|
+
Places two fingers at the edges of the screen and brings them together.
|
|
624
|
+
```ruby
|
|
625
|
+
action = pinch 75 #=> Pinch the screen from the top right and bottom left corners
|
|
626
|
+
action.perform #=> to 25% of its size.
|
|
588
627
|
```
|
|
589
628
|
|
|
590
629
|
__Parameters:__
|
|
591
630
|
|
|
592
|
-
[
|
|
593
|
-
|
|
594
|
-
__Returns:__
|
|
631
|
+
[int] percentage - The percent size by which to shrink the screen when pinched.
|
|
595
632
|
|
|
596
|
-
[
|
|
633
|
+
[boolean] auto_perform - Whether to perform the action immediately (default true)
|
|
597
634
|
|
|
598
635
|
--
|
|
599
636
|
|
|
600
|
-
##### [
|
|
637
|
+
##### [zoom](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/multi_touch.rb#L58)
|
|
601
638
|
|
|
602
|
-
> def
|
|
639
|
+
> def zoom(percentage=200, auto_perform=true)
|
|
603
640
|
|
|
641
|
+
Convenience method for zooming the screen.
|
|
642
|
+
Places two fingers at the edges of the screen and brings them together.
|
|
643
|
+
```ruby
|
|
644
|
+
action = zoom 200 #=> Zoom in the screen from the center until it doubles in size.
|
|
645
|
+
action.perform
|
|
646
|
+
```
|
|
604
647
|
|
|
648
|
+
__Parameters:__
|
|
605
649
|
|
|
606
|
-
|
|
650
|
+
[int] percentage - The percent size by which to shrink the screen when pinched.
|
|
607
651
|
|
|
608
|
-
|
|
652
|
+
[boolean] auto_perform - Whether to perform the action immediately (default true)
|
|
609
653
|
|
|
610
|
-
|
|
654
|
+
--
|
|
611
655
|
|
|
612
|
-
|
|
613
|
-
on Android name is content description
|
|
614
|
-
on iOS name is the accessibility label or the text.
|
|
656
|
+
##### [initialize](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/multi_touch.rb#L79)
|
|
615
657
|
|
|
616
|
-
|
|
658
|
+
> def initialize
|
|
617
659
|
|
|
618
|
-
|
|
660
|
+
Create a new multi-action
|
|
619
661
|
|
|
620
662
|
__Returns:__
|
|
621
663
|
|
|
622
|
-
[
|
|
664
|
+
[MultiTouch] a new instance of MultiTouch
|
|
623
665
|
|
|
624
666
|
--
|
|
625
667
|
|
|
626
|
-
##### [
|
|
668
|
+
##### [add](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/multi_touch.rb#L85)
|
|
669
|
+
|
|
670
|
+
> def add(chain)
|
|
627
671
|
|
|
628
|
-
|
|
672
|
+
Add a touch_action to be performed
|
|
629
673
|
|
|
674
|
+
__Parameters:__
|
|
630
675
|
|
|
676
|
+
[TouchAction] chain - The action to add to the chain
|
|
631
677
|
|
|
632
678
|
--
|
|
633
679
|
|
|
634
|
-
##### [
|
|
635
|
-
|
|
636
|
-
> def locate_single_textfield js
|
|
680
|
+
##### [perform](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/multi_touch.rb#L90)
|
|
637
681
|
|
|
638
|
-
|
|
682
|
+
> def perform
|
|
639
683
|
|
|
640
|
-
|
|
641
|
-
to match Android.
|
|
684
|
+
Ask Appium to perform the actions
|
|
642
685
|
|
|
643
686
|
--
|
|
644
687
|
|
|
645
|
-
##### [
|
|
688
|
+
##### [ACTIONS](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/touch_actions.rb#L12)
|
|
646
689
|
|
|
647
|
-
>
|
|
690
|
+
> ACTIONS = [:move_to, :press_for_duration, :press, :release, :tap, :wait, :perform]
|
|
648
691
|
|
|
649
|
-
Get an array of textfield texts.
|
|
650
|
-
Does not respect implicit wait because we're using execute_script.
|
|
651
|
-
|
|
652
|
-
__Returns:__
|
|
653
692
|
|
|
654
|
-
[Array<String>]
|
|
655
693
|
|
|
656
694
|
--
|
|
657
695
|
|
|
658
|
-
##### [
|
|
696
|
+
##### [COMPLEX_ACTIONS](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/touch_actions.rb#L13)
|
|
659
697
|
|
|
660
|
-
>
|
|
698
|
+
> COMPLEX_ACTIONS = [:swipe]
|
|
661
699
|
|
|
662
|
-
Get an array of textfield elements.
|
|
663
700
|
|
|
664
|
-
__Returns:__
|
|
665
701
|
|
|
666
|
-
|
|
702
|
+
--
|
|
703
|
+
|
|
704
|
+
##### [actions](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/touch_actions.rb#L27)
|
|
705
|
+
|
|
706
|
+
> def actions
|
|
707
|
+
|
|
708
|
+
Returns the value of attribute actions
|
|
667
709
|
|
|
668
710
|
--
|
|
669
711
|
|
|
670
|
-
##### [
|
|
712
|
+
##### [initialize](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/touch_actions.rb#L29)
|
|
713
|
+
|
|
714
|
+
> def initialize
|
|
671
715
|
|
|
672
|
-
> def first_textfield
|
|
673
716
|
|
|
674
|
-
Get the first textfield element.
|
|
675
717
|
|
|
676
718
|
__Returns:__
|
|
677
719
|
|
|
678
|
-
[
|
|
720
|
+
[TouchAction] a new instance of TouchAction
|
|
679
721
|
|
|
680
722
|
--
|
|
681
723
|
|
|
682
|
-
##### [
|
|
724
|
+
##### [move_to](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/touch_actions.rb#L37)
|
|
683
725
|
|
|
684
|
-
> def
|
|
726
|
+
> def move_to(opts)
|
|
685
727
|
|
|
686
|
-
|
|
728
|
+
Move to the given co-ordinates.
|
|
687
729
|
|
|
688
|
-
|
|
730
|
+
__Parameters:__
|
|
689
731
|
|
|
690
|
-
[
|
|
732
|
+
[Hash] opts - a customizable set of options
|
|
691
733
|
|
|
692
734
|
--
|
|
693
735
|
|
|
694
|
-
##### [
|
|
736
|
+
##### [press_for_duration](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/touch_actions.rb#L47)
|
|
695
737
|
|
|
696
|
-
> def
|
|
738
|
+
> def press_for_duration(element, x, y, duration)
|
|
697
739
|
|
|
698
|
-
|
|
740
|
+
Press down for a specific duration.
|
|
699
741
|
|
|
700
742
|
__Parameters:__
|
|
701
743
|
|
|
702
|
-
[
|
|
744
|
+
[WebDriver::Element] element - the element to press.
|
|
703
745
|
|
|
704
|
-
|
|
746
|
+
[integer] x - x co-ordinate to press on.
|
|
705
747
|
|
|
706
|
-
[
|
|
748
|
+
[integer] y - y co-ordinate to press on.
|
|
749
|
+
|
|
750
|
+
[integer] duration - Number of seconds to press.
|
|
707
751
|
|
|
708
752
|
--
|
|
709
753
|
|
|
710
|
-
##### [
|
|
754
|
+
##### [press](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/touch_actions.rb#L58)
|
|
711
755
|
|
|
712
|
-
> def
|
|
756
|
+
> def press(opts)
|
|
713
757
|
|
|
714
|
-
|
|
758
|
+
Press a finger onto the screen. Finger will stay down until you call
|
|
759
|
+
`release`.
|
|
715
760
|
|
|
716
761
|
__Parameters:__
|
|
717
762
|
|
|
718
|
-
[
|
|
719
|
-
|
|
720
|
-
__Returns:__
|
|
721
|
-
|
|
722
|
-
[Textfield]
|
|
763
|
+
[Hash] opts - a customizable set of options
|
|
723
764
|
|
|
724
765
|
--
|
|
725
766
|
|
|
726
|
-
##### [
|
|
767
|
+
##### [release](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/touch_actions.rb#L69)
|
|
727
768
|
|
|
728
|
-
> def
|
|
769
|
+
> def release(opts=nil)
|
|
729
770
|
|
|
730
|
-
|
|
771
|
+
Remove a finger from the screen.
|
|
731
772
|
|
|
732
773
|
__Parameters:__
|
|
733
774
|
|
|
734
|
-
[
|
|
775
|
+
[Hash] opts - a customizable set of options
|
|
735
776
|
|
|
736
|
-
|
|
777
|
+
--
|
|
778
|
+
|
|
779
|
+
##### [tap](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/touch_actions.rb#L80)
|
|
780
|
+
|
|
781
|
+
> def tap(opts)
|
|
782
|
+
|
|
783
|
+
Touch a point on the screen
|
|
784
|
+
|
|
785
|
+
__Parameters:__
|
|
737
786
|
|
|
738
|
-
[
|
|
787
|
+
[Hash] opts - a customizable set of options
|
|
739
788
|
|
|
740
789
|
--
|
|
741
790
|
|
|
742
|
-
##### [
|
|
791
|
+
##### [wait](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/touch_actions.rb#L88)
|
|
743
792
|
|
|
744
|
-
> def
|
|
793
|
+
> def wait(seconds)
|
|
745
794
|
|
|
746
|
-
|
|
795
|
+
Pause for a number of seconds before the next action
|
|
796
|
+
|
|
797
|
+
__Parameters:__
|
|
798
|
+
|
|
799
|
+
[integer] seconds - Number of seconds to pause for
|
|
800
|
+
|
|
801
|
+
--
|
|
802
|
+
|
|
803
|
+
##### [swipe](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/touch_actions.rb#L99)
|
|
804
|
+
|
|
805
|
+
> def swipe(opts)
|
|
806
|
+
|
|
807
|
+
Convenience method to peform a swipe.
|
|
808
|
+
|
|
809
|
+
__Parameters:__
|
|
810
|
+
|
|
811
|
+
[Hash] opts - a customizable set of options
|
|
812
|
+
|
|
813
|
+
--
|
|
814
|
+
|
|
815
|
+
##### [perform](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/touch_actions.rb#L114)
|
|
816
|
+
|
|
817
|
+
> def perform
|
|
818
|
+
|
|
819
|
+
Ask the driver to perform all actions in this action chain.
|
|
820
|
+
|
|
821
|
+
--
|
|
822
|
+
|
|
823
|
+
##### [cancel](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/touch_actions.rb#L120)
|
|
824
|
+
|
|
825
|
+
> def cancel
|
|
826
|
+
|
|
827
|
+
Does nothing, currently.
|
|
828
|
+
|
|
829
|
+
--
|
|
830
|
+
|
|
831
|
+
##### [chain_method](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/touch_actions.rb#L128)
|
|
832
|
+
|
|
833
|
+
> def chain_method(method, args=nil)
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
|
|
837
|
+
--
|
|
838
|
+
|
|
839
|
+
##### [args_with_ele_ref](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/touch_actions.rb#L137)
|
|
840
|
+
|
|
841
|
+
> def args_with_ele_ref(args)
|
|
747
842
|
|
|
748
|
-
__Returns:__
|
|
749
843
|
|
|
750
|
-
[Element]
|
|
751
844
|
|
|
752
845
|
--
|
|
753
846
|
|
|
754
|
-
##### [wait](https://github.com/appium/ruby_lib/blob/
|
|
847
|
+
##### [wait](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L33)
|
|
755
848
|
|
|
756
849
|
> def wait max_wait=30, interval=0.5, &block
|
|
757
850
|
|
|
@@ -778,7 +871,7 @@ __Returns:__
|
|
|
778
871
|
|
|
779
872
|
--
|
|
780
873
|
|
|
781
|
-
##### [ignore](https://github.com/appium/ruby_lib/blob/
|
|
874
|
+
##### [ignore](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L49)
|
|
782
875
|
|
|
783
876
|
> def ignore &block
|
|
784
877
|
|
|
@@ -786,11 +879,13 @@ Return block.call and ignore any exceptions.
|
|
|
786
879
|
|
|
787
880
|
--
|
|
788
881
|
|
|
789
|
-
##### [wait_true](https://github.com/appium/ruby_lib/blob/
|
|
882
|
+
##### [wait_true](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L64)
|
|
790
883
|
|
|
791
884
|
> def wait_true max_wait=30, interval=0.5, &block
|
|
792
885
|
|
|
793
|
-
Check every 0.5 seconds to see if block.call returns
|
|
886
|
+
Check every 0.5 seconds to see if block.call returns a truthy value.
|
|
887
|
+
Note this isn't a strict boolean true, any truthy value is accepted.
|
|
888
|
+
false and nil are considered failures.
|
|
794
889
|
Give up after 30 seconds.
|
|
795
890
|
|
|
796
891
|
__Parameters:__
|
|
@@ -807,7 +902,7 @@ __Returns:__
|
|
|
807
902
|
|
|
808
903
|
--
|
|
809
904
|
|
|
810
|
-
##### [back](https://github.com/appium/ruby_lib/blob/
|
|
905
|
+
##### [back](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L81)
|
|
811
906
|
|
|
812
907
|
> def back
|
|
813
908
|
|
|
@@ -819,7 +914,7 @@ __Returns:__
|
|
|
819
914
|
|
|
820
915
|
--
|
|
821
916
|
|
|
822
|
-
##### [session_id](https://github.com/appium/ruby_lib/blob/
|
|
917
|
+
##### [session_id](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L86)
|
|
823
918
|
|
|
824
919
|
> def session_id
|
|
825
920
|
|
|
@@ -827,7 +922,7 @@ For Sauce Labs reporting. Returns the current session id.
|
|
|
827
922
|
|
|
828
923
|
--
|
|
829
924
|
|
|
830
|
-
##### [xpath](https://github.com/appium/ruby_lib/blob/
|
|
925
|
+
##### [xpath](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L94)
|
|
831
926
|
|
|
832
927
|
> def xpath xpath_str
|
|
833
928
|
|
|
@@ -843,7 +938,7 @@ __Returns:__
|
|
|
843
938
|
|
|
844
939
|
--
|
|
845
940
|
|
|
846
|
-
##### [xpaths](https://github.com/appium/ruby_lib/blob/
|
|
941
|
+
##### [xpaths](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L102)
|
|
847
942
|
|
|
848
943
|
> def xpaths xpath_str
|
|
849
944
|
|
|
@@ -859,902 +954,630 @@ __Returns:__
|
|
|
859
954
|
|
|
860
955
|
--
|
|
861
956
|
|
|
862
|
-
##### [
|
|
863
|
-
|
|
864
|
-
> def ele_index tag_name, index
|
|
957
|
+
##### [source](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L108)
|
|
865
958
|
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
__Parameters:__
|
|
869
|
-
|
|
870
|
-
[String] tag_name - the tag name to find
|
|
959
|
+
> def source
|
|
871
960
|
|
|
872
|
-
|
|
961
|
+
Prints xml of the current page
|
|
873
962
|
|
|
874
963
|
__Returns:__
|
|
875
964
|
|
|
876
|
-
[
|
|
965
|
+
[void]
|
|
877
966
|
|
|
878
967
|
--
|
|
879
968
|
|
|
880
|
-
##### [
|
|
969
|
+
##### [get_source](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L118)
|
|
881
970
|
|
|
882
|
-
> def
|
|
883
|
-
|
|
884
|
-
Get all elements exactly matching tag name
|
|
885
|
-
|
|
886
|
-
__Parameters:__
|
|
971
|
+
> def get_source
|
|
887
972
|
|
|
888
|
-
|
|
973
|
+
Returns XML string for the current page
|
|
974
|
+
Same as driver.page_source
|
|
889
975
|
|
|
890
976
|
__Returns:__
|
|
891
977
|
|
|
892
|
-
[
|
|
978
|
+
[String]
|
|
893
979
|
|
|
894
980
|
--
|
|
895
981
|
|
|
896
|
-
##### [
|
|
897
|
-
|
|
898
|
-
> def find_ele_by_text tag, text
|
|
982
|
+
##### [result](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L125)
|
|
899
983
|
|
|
900
|
-
|
|
984
|
+
> def result
|
|
901
985
|
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
[String] tag - the tag name to match
|
|
905
|
-
|
|
906
|
-
[String] text - the text to exactly match
|
|
907
|
-
|
|
908
|
-
__Returns:__
|
|
909
|
-
|
|
910
|
-
[Element] the element of type tag exactly matching text
|
|
986
|
+
Returns the value of attribute result
|
|
911
987
|
|
|
912
988
|
--
|
|
913
989
|
|
|
914
|
-
##### [
|
|
990
|
+
##### [initialize](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L127)
|
|
915
991
|
|
|
916
|
-
> def
|
|
992
|
+
> def initialize
|
|
917
993
|
|
|
918
|
-
Get all tags that exactly match tag and text.
|
|
919
994
|
|
|
920
|
-
__Parameters:__
|
|
921
|
-
|
|
922
|
-
[String] tag - the tag name to match
|
|
923
|
-
|
|
924
|
-
[String] text - the text to exactly match
|
|
925
995
|
|
|
926
996
|
__Returns:__
|
|
927
997
|
|
|
928
|
-
[
|
|
998
|
+
[CountElements] a new instance of CountElements
|
|
929
999
|
|
|
930
1000
|
--
|
|
931
1001
|
|
|
932
|
-
##### [
|
|
933
|
-
|
|
934
|
-
> def find_ele_by_attr_include tag, attr, value
|
|
1002
|
+
##### [reset](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L131)
|
|
935
1003
|
|
|
936
|
-
|
|
1004
|
+
> def reset
|
|
937
1005
|
|
|
938
|
-
__Parameters:__
|
|
939
1006
|
|
|
940
|
-
[String] tag - the tag name to match
|
|
941
1007
|
|
|
942
|
-
|
|
1008
|
+
--
|
|
943
1009
|
|
|
944
|
-
|
|
1010
|
+
##### [start_element](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L136)
|
|
945
1011
|
|
|
946
|
-
|
|
1012
|
+
> def start_element name, attrs = []
|
|
947
1013
|
|
|
948
|
-
|
|
1014
|
+
http://nokogiri.org/Nokogiri/XML/SAX/Document.html
|
|
949
1015
|
|
|
950
1016
|
--
|
|
951
1017
|
|
|
952
|
-
##### [
|
|
1018
|
+
##### [formatted_result](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L140)
|
|
953
1019
|
|
|
954
|
-
> def
|
|
1020
|
+
> def formatted_result
|
|
955
1021
|
|
|
956
|
-
Get tags by attribute that include value.
|
|
957
1022
|
|
|
958
|
-
__Parameters:__
|
|
959
|
-
|
|
960
|
-
[String] tag - the tag name to match
|
|
961
1023
|
|
|
962
|
-
|
|
1024
|
+
--
|
|
963
1025
|
|
|
964
|
-
|
|
1026
|
+
##### [get_page_class](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L151)
|
|
965
1027
|
|
|
966
|
-
|
|
1028
|
+
> def get_page_class
|
|
967
1029
|
|
|
968
|
-
|
|
1030
|
+
Returns a string of class counts.
|
|
969
1031
|
|
|
970
1032
|
--
|
|
971
1033
|
|
|
972
|
-
##### [
|
|
1034
|
+
##### [page_class](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L162)
|
|
973
1035
|
|
|
974
|
-
> def
|
|
1036
|
+
> def page_class
|
|
975
1037
|
|
|
976
|
-
|
|
977
|
-
|
|
1038
|
+
Count all classes on screen and print to stdout.
|
|
1039
|
+
Useful for appium_console.
|
|
978
1040
|
|
|
979
|
-
|
|
1041
|
+
--
|
|
980
1042
|
|
|
981
|
-
|
|
1043
|
+
##### [px_to_window_rel](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L172)
|
|
982
1044
|
|
|
983
|
-
|
|
1045
|
+
> def px_to_window_rel opts={}
|
|
984
1046
|
|
|
985
|
-
|
|
1047
|
+
Converts pixel values to window relative values
|
|
986
1048
|
|
|
987
|
-
|
|
1049
|
+
```ruby
|
|
1050
|
+
px_to_window_rel x: 50, y: 150
|
|
1051
|
+
```
|
|
988
1052
|
|
|
989
1053
|
--
|
|
990
1054
|
|
|
991
|
-
##### [
|
|
1055
|
+
##### [xml_keys](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L189)
|
|
992
1056
|
|
|
993
|
-
> def
|
|
1057
|
+
> def xml_keys target
|
|
994
1058
|
|
|
995
|
-
|
|
996
|
-
element.attribute(:text).include? text
|
|
1059
|
+
Search strings.xml's values for target.
|
|
997
1060
|
|
|
998
1061
|
__Parameters:__
|
|
999
1062
|
|
|
1000
|
-
[String]
|
|
1001
|
-
|
|
1002
|
-
[String] text - the text the element must include
|
|
1063
|
+
[String] target - the target to search for in strings.xml values
|
|
1003
1064
|
|
|
1004
1065
|
__Returns:__
|
|
1005
1066
|
|
|
1006
|
-
[Array
|
|
1067
|
+
[Array]
|
|
1007
1068
|
|
|
1008
1069
|
--
|
|
1009
1070
|
|
|
1010
|
-
##### [
|
|
1071
|
+
##### [xml_values](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L197)
|
|
1011
1072
|
|
|
1012
|
-
> def
|
|
1073
|
+
> def xml_values target
|
|
1013
1074
|
|
|
1014
|
-
|
|
1075
|
+
Search strings.xml's keys for target.
|
|
1015
1076
|
|
|
1016
1077
|
__Parameters:__
|
|
1017
1078
|
|
|
1018
|
-
[String]
|
|
1079
|
+
[String] target - the target to search for in strings.xml keys
|
|
1019
1080
|
|
|
1020
1081
|
__Returns:__
|
|
1021
1082
|
|
|
1022
|
-
[
|
|
1083
|
+
[Array]
|
|
1023
1084
|
|
|
1024
1085
|
--
|
|
1025
1086
|
|
|
1026
|
-
##### [
|
|
1087
|
+
##### [resolve_id](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L205)
|
|
1027
1088
|
|
|
1028
|
-
> def
|
|
1089
|
+
> def resolve_id id
|
|
1029
1090
|
|
|
1030
|
-
|
|
1091
|
+
Resolve id in strings.xml and return the value.
|
|
1031
1092
|
|
|
1032
1093
|
__Parameters:__
|
|
1033
1094
|
|
|
1034
|
-
[String]
|
|
1095
|
+
[String] id - the id to resolve
|
|
1035
1096
|
|
|
1036
1097
|
__Returns:__
|
|
1037
1098
|
|
|
1038
|
-
[
|
|
1099
|
+
[String]
|
|
1039
1100
|
|
|
1040
1101
|
--
|
|
1041
1102
|
|
|
1042
|
-
##### [
|
|
1043
|
-
|
|
1044
|
-
> def source
|
|
1045
|
-
|
|
1046
|
-
Prints a JSON view of the current page
|
|
1103
|
+
##### [window_size](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/element/window.rb#L5)
|
|
1047
1104
|
|
|
1048
|
-
|
|
1105
|
+
> def window_size
|
|
1049
1106
|
|
|
1050
|
-
|
|
1107
|
+
Get the window's size
|
|
1051
1108
|
|
|
1052
1109
|
--
|
|
1053
1110
|
|
|
1054
|
-
##### [
|
|
1055
|
-
|
|
1056
|
-
> def get_source
|
|
1111
|
+
##### [UIAStaticText](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/text.rb#L4) ios
|
|
1057
1112
|
|
|
1058
|
-
|
|
1113
|
+
> UIAStaticText = 'UIAStaticText'
|
|
1059
1114
|
|
|
1060
|
-
__Returns:__
|
|
1061
1115
|
|
|
1062
|
-
[JSON]
|
|
1063
1116
|
|
|
1064
1117
|
--
|
|
1065
1118
|
|
|
1066
|
-
##### [
|
|
1119
|
+
##### [s_text](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/text.rb#L10) ios
|
|
1067
1120
|
|
|
1068
|
-
> def
|
|
1121
|
+
> def s_text value
|
|
1069
1122
|
|
|
1070
|
-
|
|
1123
|
+
Find the first UIAStaticText that contains value or by index.
|
|
1124
|
+
If int then the UIAStaticText at that index is returned.
|
|
1071
1125
|
|
|
1072
1126
|
__Parameters:__
|
|
1073
1127
|
|
|
1074
|
-
[String]
|
|
1128
|
+
[String, Integer] value - the value to find.
|
|
1075
1129
|
|
|
1076
1130
|
__Returns:__
|
|
1077
1131
|
|
|
1078
|
-
[
|
|
1132
|
+
[UIAStaticText]
|
|
1079
1133
|
|
|
1080
1134
|
--
|
|
1081
1135
|
|
|
1082
|
-
##### [
|
|
1136
|
+
##### [s_texts](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/text.rb#L18) ios
|
|
1083
1137
|
|
|
1084
|
-
> def
|
|
1138
|
+
> def s_texts value
|
|
1085
1139
|
|
|
1086
|
-
|
|
1140
|
+
Find all UIAStaticText containing value.
|
|
1087
1141
|
|
|
1088
1142
|
__Parameters:__
|
|
1089
1143
|
|
|
1090
|
-
[String]
|
|
1144
|
+
[String] value - the value to search for
|
|
1091
1145
|
|
|
1092
1146
|
__Returns:__
|
|
1093
1147
|
|
|
1094
|
-
[Array<
|
|
1148
|
+
[Array<UIAStaticText>]
|
|
1095
1149
|
|
|
1096
1150
|
--
|
|
1097
1151
|
|
|
1098
|
-
##### [
|
|
1099
|
-
|
|
1100
|
-
> def tag tag_name
|
|
1152
|
+
##### [first_s_text](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/text.rb#L24) ios
|
|
1101
1153
|
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
__Parameters:__
|
|
1154
|
+
> def first_s_text
|
|
1105
1155
|
|
|
1106
|
-
|
|
1156
|
+
Find the first UIAStaticText.
|
|
1107
1157
|
|
|
1108
1158
|
__Returns:__
|
|
1109
1159
|
|
|
1110
|
-
[
|
|
1160
|
+
[UIAStaticText]
|
|
1111
1161
|
|
|
1112
1162
|
--
|
|
1113
1163
|
|
|
1114
|
-
##### [
|
|
1115
|
-
|
|
1116
|
-
> def tags tag_name
|
|
1117
|
-
|
|
1118
|
-
Returns all elements matching tag_name
|
|
1164
|
+
##### [last_s_text](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/text.rb#L30) ios
|
|
1119
1165
|
|
|
1120
|
-
|
|
1166
|
+
> def last_s_text
|
|
1121
1167
|
|
|
1122
|
-
|
|
1168
|
+
Find the last UIAStaticText.
|
|
1123
1169
|
|
|
1124
1170
|
__Returns:__
|
|
1125
1171
|
|
|
1126
|
-
[
|
|
1127
|
-
|
|
1128
|
-
--
|
|
1129
|
-
|
|
1130
|
-
##### [px_to_window_rel](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L228)
|
|
1131
|
-
|
|
1132
|
-
> def px_to_window_rel opts={}
|
|
1133
|
-
|
|
1134
|
-
Converts pixel values to window relative values
|
|
1135
|
-
|
|
1136
|
-
```ruby
|
|
1137
|
-
px_to_window_rel x: 50, y: 150
|
|
1138
|
-
```
|
|
1139
|
-
|
|
1140
|
-
--
|
|
1141
|
-
|
|
1142
|
-
##### [lazy_load_strings](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L238)
|
|
1143
|
-
|
|
1144
|
-
> def lazy_load_strings
|
|
1145
|
-
|
|
1146
|
-
|
|
1172
|
+
[UIAStaticText]
|
|
1147
1173
|
|
|
1148
1174
|
--
|
|
1149
1175
|
|
|
1150
|
-
##### [
|
|
1176
|
+
##### [s_text_exact](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/text.rb#L37) ios
|
|
1151
1177
|
|
|
1152
|
-
> def
|
|
1178
|
+
> def s_text_exact value
|
|
1153
1179
|
|
|
1154
|
-
|
|
1180
|
+
Find the first UIAStaticText that exactly matches value.
|
|
1155
1181
|
|
|
1156
1182
|
__Parameters:__
|
|
1157
1183
|
|
|
1158
|
-
[String]
|
|
1184
|
+
[String] value - the value to match exactly
|
|
1159
1185
|
|
|
1160
1186
|
__Returns:__
|
|
1161
1187
|
|
|
1162
|
-
[
|
|
1188
|
+
[UIAStaticText]
|
|
1163
1189
|
|
|
1164
1190
|
--
|
|
1165
1191
|
|
|
1166
|
-
##### [
|
|
1192
|
+
##### [s_texts_exact](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/text.rb#L44) ios
|
|
1167
1193
|
|
|
1168
|
-
> def
|
|
1194
|
+
> def s_texts_exact value
|
|
1169
1195
|
|
|
1170
|
-
|
|
1196
|
+
Find all UIAStaticTexts that exactly match value.
|
|
1171
1197
|
|
|
1172
1198
|
__Parameters:__
|
|
1173
1199
|
|
|
1174
|
-
[String]
|
|
1200
|
+
[String] value - the value to match exactly
|
|
1175
1201
|
|
|
1176
1202
|
__Returns:__
|
|
1177
1203
|
|
|
1178
|
-
[Array]
|
|
1204
|
+
[Array<UIAStaticText>]
|
|
1179
1205
|
|
|
1180
1206
|
--
|
|
1181
1207
|
|
|
1182
|
-
##### [
|
|
1183
|
-
|
|
1184
|
-
> def resolve_id id
|
|
1185
|
-
|
|
1186
|
-
Resolve id in strings.xml and return the value.
|
|
1208
|
+
##### [e_s_texts](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/text.rb#L50) ios
|
|
1187
1209
|
|
|
1188
|
-
|
|
1210
|
+
> def e_s_texts
|
|
1189
1211
|
|
|
1190
|
-
|
|
1212
|
+
Find all UIAStaticTexts.
|
|
1191
1213
|
|
|
1192
1214
|
__Returns:__
|
|
1193
1215
|
|
|
1194
|
-
[
|
|
1216
|
+
[Array<UIAStaticText>]
|
|
1195
1217
|
|
|
1196
1218
|
--
|
|
1197
1219
|
|
|
1198
|
-
##### [
|
|
1199
|
-
|
|
1200
|
-
> def raise_no_element_error
|
|
1201
|
-
|
|
1202
|
-
Used to error when finding a single element fails.
|
|
1203
|
-
|
|
1204
|
-
--
|
|
1205
|
-
|
|
1206
|
-
##### [value](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/patch.rb#L32)
|
|
1207
|
-
|
|
1208
|
-
> def value
|
|
1209
|
-
|
|
1210
|
-
Returns the value attribute
|
|
1211
|
-
|
|
1212
|
-
Fixes NoMethodError: undefined method `value' for Selenium::WebDriver::Element
|
|
1213
|
-
|
|
1214
|
-
--
|
|
1220
|
+
##### [alert_accept](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/alert.rb#L5) ios
|
|
1215
1221
|
|
|
1216
|
-
|
|
1222
|
+
> def alert_accept
|
|
1217
1223
|
|
|
1218
|
-
|
|
1224
|
+
Accept the alert.
|
|
1219
1225
|
|
|
1220
|
-
|
|
1226
|
+
__Returns:__
|
|
1221
1227
|
|
|
1222
|
-
|
|
1228
|
+
[void]
|
|
1223
1229
|
|
|
1224
1230
|
--
|
|
1225
1231
|
|
|
1226
|
-
##### [
|
|
1227
|
-
|
|
1228
|
-
> def location_rel
|
|
1232
|
+
##### [alert_dismiss](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/alert.rb#L13) ios
|
|
1229
1233
|
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
```ruby
|
|
1233
|
-
execute_script 'mobile: tap', :x => 0.0, :y => 0.98
|
|
1234
|
-
```
|
|
1234
|
+
> def alert_dismiss
|
|
1235
1235
|
|
|
1236
|
-
|
|
1236
|
+
Dismiss the alert.
|
|
1237
1237
|
|
|
1238
1238
|
__Returns:__
|
|
1239
1239
|
|
|
1240
|
-
[
|
|
1240
|
+
[void]
|
|
1241
1241
|
|
|
1242
1242
|
--
|
|
1243
1243
|
|
|
1244
|
-
##### [
|
|
1244
|
+
##### [uiautomation_find](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/mobile_methods.rb#L10) ios
|
|
1245
1245
|
|
|
1246
|
-
>
|
|
1246
|
+
> def uiautomation_find
|
|
1247
1247
|
|
|
1248
|
+
find_element/s can be used with a [UIAutomation command](https://developer.apple.com/library/ios/documentation/ToolsLanguages/Reference/UIAWindowClassReference/UIAWindow/UIAWindow.html#//apple_ref/doc/uid/TP40009930).
|
|
1248
1249
|
|
|
1250
|
+
```ruby
|
|
1251
|
+
find_elements :uiautomation, 'elements()
|
|
1252
|
+
```
|
|
1249
1253
|
|
|
1250
1254
|
--
|
|
1251
1255
|
|
|
1252
|
-
##### [
|
|
1256
|
+
##### [UIAButton](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/button.rb#L4) ios
|
|
1253
1257
|
|
|
1254
|
-
>
|
|
1258
|
+
> UIAButton = 'UIAButton'
|
|
1255
1259
|
|
|
1256
1260
|
|
|
1257
1261
|
|
|
1258
1262
|
--
|
|
1259
1263
|
|
|
1260
|
-
##### [
|
|
1264
|
+
##### [button](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/button.rb#L10) ios
|
|
1261
1265
|
|
|
1262
|
-
> def
|
|
1266
|
+
> def button value
|
|
1263
1267
|
|
|
1264
|
-
|
|
1265
|
-
|
|
1268
|
+
Find the first UIAButton that contains value or by index.
|
|
1269
|
+
If int then the UIAButton at that index is returned.
|
|
1266
1270
|
|
|
1267
1271
|
__Parameters:__
|
|
1268
1272
|
|
|
1269
|
-
[
|
|
1273
|
+
[String, Integer] value - the value to exactly match.
|
|
1270
1274
|
|
|
1271
1275
|
__Returns:__
|
|
1272
1276
|
|
|
1273
|
-
[
|
|
1277
|
+
[UIAButton]
|
|
1274
1278
|
|
|
1275
1279
|
--
|
|
1276
1280
|
|
|
1277
|
-
##### [
|
|
1278
|
-
|
|
1279
|
-
> def self.promote_singleton_appium_methods main_module
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
--
|
|
1284
|
-
|
|
1285
|
-
##### [promote_appium_methods](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L175)
|
|
1286
|
-
|
|
1287
|
-
> def self.promote_appium_methods class_array
|
|
1288
|
-
|
|
1289
|
-
Promote appium methods to class instance methods
|
|
1281
|
+
##### [buttons](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/button.rb#L19) ios
|
|
1290
1282
|
|
|
1291
|
-
|
|
1283
|
+
> def buttons value
|
|
1292
1284
|
|
|
1293
|
-
|
|
1294
|
-
Appium.promote_appium_methods Object
|
|
1295
|
-
```
|
|
1285
|
+
Find all UIAButtons containing value
|
|
1296
1286
|
|
|
1297
1287
|
__Parameters:__
|
|
1298
1288
|
|
|
1299
|
-
[
|
|
1300
|
-
|
|
1301
|
-
--
|
|
1302
|
-
|
|
1303
|
-
##### [default_wait](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L550)
|
|
1304
|
-
|
|
1305
|
-
> def default_wait
|
|
1306
|
-
|
|
1307
|
-
Returns the default client side wait.
|
|
1308
|
-
This value is independent of what the server is using
|
|
1289
|
+
[String] value - the value to search for
|
|
1309
1290
|
|
|
1310
1291
|
__Returns:__
|
|
1311
1292
|
|
|
1312
|
-
[
|
|
1313
|
-
|
|
1314
|
-
--
|
|
1315
|
-
|
|
1316
|
-
##### [app_path](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L204)
|
|
1317
|
-
|
|
1318
|
-
> def app_path
|
|
1319
|
-
|
|
1320
|
-
Returns the value of attribute app_path
|
|
1321
|
-
|
|
1322
|
-
--
|
|
1323
|
-
|
|
1324
|
-
##### [app_name](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L204)
|
|
1325
|
-
|
|
1326
|
-
> def app_name
|
|
1327
|
-
|
|
1328
|
-
Returns the value of attribute app_name
|
|
1293
|
+
[Array<UIAButton>]
|
|
1329
1294
|
|
|
1330
1295
|
--
|
|
1331
1296
|
|
|
1332
|
-
##### [
|
|
1297
|
+
##### [first_button](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/button.rb#L25) ios
|
|
1333
1298
|
|
|
1334
|
-
> def
|
|
1335
|
-
|
|
1336
|
-
Returns the value of attribute device
|
|
1337
|
-
|
|
1338
|
-
--
|
|
1299
|
+
> def first_button
|
|
1339
1300
|
|
|
1340
|
-
|
|
1301
|
+
Find the first UIAButton.
|
|
1341
1302
|
|
|
1342
|
-
|
|
1303
|
+
__Returns:__
|
|
1343
1304
|
|
|
1344
|
-
|
|
1305
|
+
[UIAButton]
|
|
1345
1306
|
|
|
1346
1307
|
--
|
|
1347
1308
|
|
|
1348
|
-
##### [
|
|
1349
|
-
|
|
1350
|
-
> def app_activity
|
|
1351
|
-
|
|
1352
|
-
Returns the value of attribute app_activity
|
|
1309
|
+
##### [last_button](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/button.rb#L31) ios
|
|
1353
1310
|
|
|
1354
|
-
|
|
1311
|
+
> def last_button
|
|
1355
1312
|
|
|
1356
|
-
|
|
1313
|
+
Find the last UIAButton.
|
|
1357
1314
|
|
|
1358
|
-
|
|
1315
|
+
__Returns:__
|
|
1359
1316
|
|
|
1360
|
-
|
|
1317
|
+
[UIAButton]
|
|
1361
1318
|
|
|
1362
1319
|
--
|
|
1363
1320
|
|
|
1364
|
-
##### [
|
|
1321
|
+
##### [button_exact](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/button.rb#L38) ios
|
|
1365
1322
|
|
|
1366
|
-
> def
|
|
1323
|
+
> def button_exact value
|
|
1367
1324
|
|
|
1368
|
-
|
|
1325
|
+
Find the first UIAButton that exactly matches value.
|
|
1369
1326
|
|
|
1370
|
-
|
|
1327
|
+
__Parameters:__
|
|
1371
1328
|
|
|
1372
|
-
|
|
1329
|
+
[String] value - the value to match exactly
|
|
1373
1330
|
|
|
1374
|
-
|
|
1331
|
+
__Returns:__
|
|
1375
1332
|
|
|
1376
|
-
|
|
1333
|
+
[UIAButton]
|
|
1377
1334
|
|
|
1378
1335
|
--
|
|
1379
1336
|
|
|
1380
|
-
##### [
|
|
1337
|
+
##### [buttons_exact](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/button.rb#L45) ios
|
|
1381
1338
|
|
|
1382
|
-
> def
|
|
1339
|
+
> def buttons_exact value
|
|
1383
1340
|
|
|
1384
|
-
|
|
1341
|
+
Find all UIAButtons that exactly match value.
|
|
1385
1342
|
|
|
1386
|
-
|
|
1343
|
+
__Parameters:__
|
|
1387
1344
|
|
|
1388
|
-
|
|
1345
|
+
[String] value - the value to match exactly
|
|
1389
1346
|
|
|
1390
|
-
|
|
1347
|
+
__Returns:__
|
|
1391
1348
|
|
|
1392
|
-
|
|
1349
|
+
[Array<UIAButton>]
|
|
1393
1350
|
|
|
1394
1351
|
--
|
|
1395
1352
|
|
|
1396
|
-
##### [
|
|
1397
|
-
|
|
1398
|
-
> def export_session
|
|
1353
|
+
##### [e_buttons](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/button.rb#L51) ios
|
|
1399
1354
|
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
--
|
|
1355
|
+
> def e_buttons
|
|
1403
1356
|
|
|
1404
|
-
|
|
1357
|
+
Find all UIAButtons.
|
|
1405
1358
|
|
|
1406
|
-
|
|
1359
|
+
__Returns:__
|
|
1407
1360
|
|
|
1408
|
-
|
|
1361
|
+
[Array<UIAButton>]
|
|
1409
1362
|
|
|
1410
1363
|
--
|
|
1411
1364
|
|
|
1412
|
-
##### [
|
|
1365
|
+
##### [find](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/generic.rb#L7) ios
|
|
1413
1366
|
|
|
1414
|
-
> def
|
|
1367
|
+
> def find value
|
|
1415
1368
|
|
|
1416
|
-
|
|
1369
|
+
Find the first element containing value
|
|
1417
1370
|
|
|
1418
|
-
|
|
1371
|
+
__Parameters:__
|
|
1419
1372
|
|
|
1420
|
-
|
|
1373
|
+
[String] value - the value to search for
|
|
1421
1374
|
|
|
1422
|
-
|
|
1375
|
+
__Returns:__
|
|
1423
1376
|
|
|
1424
|
-
|
|
1377
|
+
[Element]
|
|
1425
1378
|
|
|
1426
1379
|
--
|
|
1427
1380
|
|
|
1428
|
-
##### [
|
|
1381
|
+
##### [finds](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/generic.rb#L14) ios
|
|
1429
1382
|
|
|
1430
|
-
> def
|
|
1383
|
+
> def finds value
|
|
1431
1384
|
|
|
1432
|
-
|
|
1385
|
+
Find all elements containing value
|
|
1433
1386
|
|
|
1434
|
-
|
|
1387
|
+
__Parameters:__
|
|
1435
1388
|
|
|
1436
|
-
|
|
1389
|
+
[String] value - the value to search for
|
|
1437
1390
|
|
|
1438
|
-
|
|
1391
|
+
__Returns:__
|
|
1439
1392
|
|
|
1440
|
-
|
|
1393
|
+
[Array<Element>]
|
|
1441
1394
|
|
|
1442
1395
|
--
|
|
1443
1396
|
|
|
1444
|
-
##### [
|
|
1445
|
-
|
|
1446
|
-
> def initialize opts={}
|
|
1447
|
-
|
|
1448
|
-
Creates a new driver.
|
|
1449
|
-
:device is :android, :ios, or :selendroid
|
|
1450
|
-
|
|
1451
|
-
```ruby
|
|
1452
|
-
# Options include:
|
|
1453
|
-
:app_path, :app_name, :app_package, :app_activity,
|
|
1454
|
-
:app_wait_activity, :sauce_username, :sauce_access_key,
|
|
1455
|
-
:port, :os, :debug
|
|
1456
|
-
|
|
1457
|
-
require 'rubygems'
|
|
1458
|
-
require 'appium_lib'
|
|
1397
|
+
##### [find_exact](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/generic.rb#L21) ios
|
|
1459
1398
|
|
|
1460
|
-
|
|
1461
|
-
app = { device: :ios, app_path: '/path/to/MyiOS.app'}
|
|
1462
|
-
Appium::Driver.new(app).start_driver
|
|
1399
|
+
> def find_exact value
|
|
1463
1400
|
|
|
1464
|
-
|
|
1465
|
-
apk = { device: :android
|
|
1466
|
-
app_path: '/path/to/the.apk',
|
|
1467
|
-
app_package: 'com.example.pkg',
|
|
1468
|
-
app_activity: 'act.Start',
|
|
1469
|
-
app_wait_activity: 'act.Start'
|
|
1470
|
-
}
|
|
1471
|
-
|
|
1472
|
-
Appium::Driver.new(apk).start_driver
|
|
1473
|
-
```
|
|
1401
|
+
Find the first element exactly matching value
|
|
1474
1402
|
|
|
1475
1403
|
__Parameters:__
|
|
1476
1404
|
|
|
1477
|
-
[
|
|
1405
|
+
[String] value - the value to search for
|
|
1478
1406
|
|
|
1479
1407
|
__Returns:__
|
|
1480
1408
|
|
|
1481
|
-
[
|
|
1409
|
+
[Element]
|
|
1482
1410
|
|
|
1483
1411
|
--
|
|
1484
1412
|
|
|
1485
|
-
##### [
|
|
1486
|
-
|
|
1487
|
-
> def status
|
|
1488
|
-
|
|
1489
|
-
Returns the status payload
|
|
1413
|
+
##### [finds_exact](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/generic.rb#L28) ios
|
|
1490
1414
|
|
|
1491
|
-
|
|
1492
|
-
{"status"=>0,
|
|
1493
|
-
"value"=>
|
|
1494
|
-
{"build"=>
|
|
1495
|
-
{"version"=>"0.8.2",
|
|
1496
|
-
"revision"=>"f2a2bc3782e4b0370d97a097d7e04913cf008995"}},
|
|
1497
|
-
"sessionId"=>"8f4b34a7-a9a9-4ac5-b125-36258143446a"}
|
|
1498
|
-
```
|
|
1415
|
+
> def finds_exact value
|
|
1499
1416
|
|
|
1500
|
-
|
|
1417
|
+
Find all elements exactly matching value
|
|
1501
1418
|
|
|
1502
|
-
|
|
1503
|
-
`f2a2bc3782e4b0370d97a097d7e04913cf008995`
|
|
1504
|
-
|
|
1505
|
-
__Returns:__
|
|
1506
|
-
|
|
1507
|
-
[JSON]
|
|
1508
|
-
|
|
1509
|
-
--
|
|
1510
|
-
|
|
1511
|
-
##### [server_version](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L369)
|
|
1512
|
-
|
|
1513
|
-
> def server_version
|
|
1419
|
+
__Parameters:__
|
|
1514
1420
|
|
|
1515
|
-
|
|
1421
|
+
[String] value - the value to search for
|
|
1516
1422
|
|
|
1517
1423
|
__Returns:__
|
|
1518
1424
|
|
|
1519
|
-
[
|
|
1425
|
+
[Array<Element>]
|
|
1520
1426
|
|
|
1521
1427
|
--
|
|
1522
1428
|
|
|
1523
|
-
##### [
|
|
1524
|
-
|
|
1525
|
-
> def self.absolute_app_path app_path
|
|
1429
|
+
##### [UIATextField](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/textfield.rb#L3) ios
|
|
1526
1430
|
|
|
1527
|
-
|
|
1431
|
+
> UIATextField = 'UIATextField'
|
|
1528
1432
|
|
|
1529
|
-
__Returns:__
|
|
1530
1433
|
|
|
1531
|
-
[String] APP_PATH as an absolute path
|
|
1532
1434
|
|
|
1533
1435
|
--
|
|
1534
1436
|
|
|
1535
|
-
##### [
|
|
1437
|
+
##### [UIASecureTextField](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/textfield.rb#L4) ios
|
|
1536
1438
|
|
|
1537
|
-
>
|
|
1439
|
+
> UIASecureTextField = 'UIASecureTextField'
|
|
1538
1440
|
|
|
1539
|
-
Get the server url for sauce or local based on env vars.
|
|
1540
1441
|
|
|
1541
|
-
__Returns:__
|
|
1542
|
-
|
|
1543
|
-
[String] the server url
|
|
1544
1442
|
|
|
1545
1443
|
--
|
|
1546
1444
|
|
|
1547
|
-
##### [
|
|
1548
|
-
|
|
1549
|
-
> def restart
|
|
1550
|
-
|
|
1551
|
-
Restarts the driver
|
|
1552
|
-
|
|
1553
|
-
__Returns:__
|
|
1554
|
-
|
|
1555
|
-
[Driver] the driver
|
|
1445
|
+
##### [textfield](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/textfield.rb#L38) ios
|
|
1556
1446
|
|
|
1557
|
-
|
|
1447
|
+
> def textfield value
|
|
1558
1448
|
|
|
1559
|
-
|
|
1449
|
+
Find the first TextField that contains value or by index.
|
|
1450
|
+
If int then the TextField at that index is returned.
|
|
1560
1451
|
|
|
1561
|
-
|
|
1452
|
+
__Parameters:__
|
|
1562
1453
|
|
|
1563
|
-
|
|
1454
|
+
[String, Integer] value - the text to match exactly.
|
|
1564
1455
|
|
|
1565
1456
|
__Returns:__
|
|
1566
1457
|
|
|
1567
|
-
[
|
|
1458
|
+
[TextField]
|
|
1568
1459
|
|
|
1569
1460
|
--
|
|
1570
1461
|
|
|
1571
|
-
##### [
|
|
1462
|
+
##### [textfields](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/textfield.rb#L54) ios
|
|
1572
1463
|
|
|
1573
|
-
> def
|
|
1574
|
-
|
|
1575
|
-
Takes a png screenshot and saves to the target path.
|
|
1464
|
+
> def textfields value
|
|
1576
1465
|
|
|
1577
|
-
|
|
1466
|
+
Find all TextFields containing value.
|
|
1578
1467
|
|
|
1579
1468
|
__Parameters:__
|
|
1580
1469
|
|
|
1581
|
-
[String]
|
|
1470
|
+
[String] value - the value to search for
|
|
1582
1471
|
|
|
1583
1472
|
__Returns:__
|
|
1584
1473
|
|
|
1585
|
-
[
|
|
1474
|
+
[Array<TextField>]
|
|
1586
1475
|
|
|
1587
1476
|
--
|
|
1588
1477
|
|
|
1589
|
-
##### [
|
|
1478
|
+
##### [first_textfield](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/textfield.rb#L60) ios
|
|
1590
1479
|
|
|
1591
|
-
> def
|
|
1480
|
+
> def first_textfield
|
|
1592
1481
|
|
|
1593
|
-
|
|
1482
|
+
Find the first TextField.
|
|
1594
1483
|
|
|
1595
1484
|
__Returns:__
|
|
1596
1485
|
|
|
1597
|
-
[
|
|
1486
|
+
[TextField]
|
|
1598
1487
|
|
|
1599
1488
|
--
|
|
1600
1489
|
|
|
1601
|
-
##### [
|
|
1490
|
+
##### [last_textfield](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/textfield.rb#L66) ios
|
|
1602
1491
|
|
|
1603
|
-
> def
|
|
1492
|
+
> def last_textfield
|
|
1604
1493
|
|
|
1605
|
-
|
|
1494
|
+
Find the last TextField.
|
|
1606
1495
|
|
|
1607
1496
|
__Returns:__
|
|
1608
1497
|
|
|
1609
|
-
[
|
|
1610
|
-
|
|
1611
|
-
--
|
|
1612
|
-
|
|
1613
|
-
##### [no_wait](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L513)
|
|
1614
|
-
|
|
1615
|
-
> def no_wait
|
|
1616
|
-
|
|
1617
|
-
Set implicit wait and default_wait to zero.
|
|
1498
|
+
[TextField]
|
|
1618
1499
|
|
|
1619
1500
|
--
|
|
1620
1501
|
|
|
1621
|
-
##### [
|
|
1622
|
-
|
|
1623
|
-
> def set_wait timeout=nil
|
|
1502
|
+
##### [textfield_exact](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/textfield.rb#L73) ios
|
|
1624
1503
|
|
|
1625
|
-
|
|
1626
|
-
if set_wait is called without a param then the second to last
|
|
1627
|
-
wait will be used.
|
|
1504
|
+
> def textfield_exact value
|
|
1628
1505
|
|
|
1629
|
-
|
|
1630
|
-
set_wait 2
|
|
1631
|
-
set_wait 3
|
|
1632
|
-
set_wait # 2
|
|
1633
|
-
|
|
1634
|
-
````
|
|
1506
|
+
Find the first TextField that exactly matches value.
|
|
1635
1507
|
|
|
1636
1508
|
__Parameters:__
|
|
1637
1509
|
|
|
1638
|
-
[
|
|
1510
|
+
[String] value - the value to match exactly
|
|
1639
1511
|
|
|
1640
1512
|
__Returns:__
|
|
1641
1513
|
|
|
1642
|
-
[
|
|
1514
|
+
[TextField]
|
|
1643
1515
|
|
|
1644
1516
|
--
|
|
1645
1517
|
|
|
1646
|
-
##### [
|
|
1518
|
+
##### [textfields_exact](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/textfield.rb#L80) ios
|
|
1647
1519
|
|
|
1648
|
-
> def
|
|
1520
|
+
> def textfields_exact value
|
|
1649
1521
|
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
Example:
|
|
1653
|
-
|
|
1654
|
-
exists { button('sign in') } ? puts('true') : puts('false')
|
|
1522
|
+
Find all TextFields that exactly match value.
|
|
1655
1523
|
|
|
1656
1524
|
__Parameters:__
|
|
1657
1525
|
|
|
1658
|
-
[
|
|
1659
|
-
wait to before checking existance
|
|
1660
|
-
|
|
1661
|
-
[Integer] post_check - the amount in seconds to set the
|
|
1662
|
-
wait to after checking existance
|
|
1663
|
-
|
|
1664
|
-
[Block] search_block - the block to call
|
|
1526
|
+
[String] value - the value to match exactly
|
|
1665
1527
|
|
|
1666
1528
|
__Returns:__
|
|
1667
1529
|
|
|
1668
|
-
[
|
|
1530
|
+
[Array<TextField>]
|
|
1669
1531
|
|
|
1670
1532
|
--
|
|
1671
1533
|
|
|
1672
|
-
##### [
|
|
1673
|
-
|
|
1674
|
-
> def execute_script script, *args
|
|
1675
|
-
|
|
1676
|
-
The same as @driver.execute_script
|
|
1534
|
+
##### [e_textfields](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/ios/element/textfield.rb#L86) ios
|
|
1677
1535
|
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
[String] script - the script to execute
|
|
1536
|
+
> def e_textfields
|
|
1681
1537
|
|
|
1682
|
-
|
|
1538
|
+
Find all TextFields.
|
|
1683
1539
|
|
|
1684
1540
|
__Returns:__
|
|
1685
1541
|
|
|
1686
|
-
[
|
|
1542
|
+
[Array<TextField>]
|
|
1687
1543
|
|
|
1688
1544
|
--
|
|
1689
1545
|
|
|
1690
|
-
##### [
|
|
1546
|
+
##### [value](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/patch.rb#L10)
|
|
1691
1547
|
|
|
1692
|
-
> def
|
|
1693
|
-
|
|
1694
|
-
Helper method for mobile gestures
|
|
1695
|
-
|
|
1696
|
-
https://github.com/appium/appium/wiki/Automating-mobile-gestures
|
|
1697
|
-
|
|
1698
|
-
driver.execute_script 'mobile: swipe', endX: 100, endY: 100, duration: 0.01
|
|
1699
|
-
|
|
1700
|
-
becomes
|
|
1701
|
-
|
|
1702
|
-
mobile :swipe, endX: 100, endY: 100, duration: 0.01
|
|
1703
|
-
|
|
1704
|
-
__Parameters:__
|
|
1705
|
-
|
|
1706
|
-
[String, Symbol] method - the method to execute
|
|
1707
|
-
|
|
1708
|
-
[*args] args - the args to pass to the method
|
|
1548
|
+
> def value
|
|
1709
1549
|
|
|
1710
|
-
|
|
1550
|
+
Returns the value attribute
|
|
1711
1551
|
|
|
1712
|
-
|
|
1552
|
+
Fixes NoMethodError: undefined method `value' for Selenium::WebDriver::Element
|
|
1713
1553
|
|
|
1714
1554
|
--
|
|
1715
1555
|
|
|
1716
|
-
##### [
|
|
1717
|
-
|
|
1718
|
-
> def find_elements *args
|
|
1556
|
+
##### [name](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/patch.rb#L17)
|
|
1719
1557
|
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
__Parameters:__
|
|
1723
|
-
|
|
1724
|
-
[*args] args - the args to use
|
|
1558
|
+
> def name
|
|
1725
1559
|
|
|
1726
|
-
|
|
1560
|
+
Returns the name attribute
|
|
1727
1561
|
|
|
1728
|
-
|
|
1562
|
+
Fixes NoMethodError: undefined method `name' for Selenium::WebDriver::Element
|
|
1729
1563
|
|
|
1730
1564
|
--
|
|
1731
1565
|
|
|
1732
|
-
##### [
|
|
1733
|
-
|
|
1734
|
-
> def find_element *args
|
|
1735
|
-
|
|
1736
|
-
Calls @driver.find_elements
|
|
1737
|
-
|
|
1738
|
-
__Parameters:__
|
|
1739
|
-
|
|
1740
|
-
[*args] args - the args to use
|
|
1741
|
-
|
|
1742
|
-
__Returns:__
|
|
1743
|
-
|
|
1744
|
-
[Element]
|
|
1566
|
+
##### [location_rel](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/patch.rb#L29)
|
|
1745
1567
|
|
|
1746
|
-
|
|
1568
|
+
> def location_rel
|
|
1747
1569
|
|
|
1748
|
-
|
|
1570
|
+
For use with mobile tap.
|
|
1749
1571
|
|
|
1750
|
-
|
|
1572
|
+
```ruby
|
|
1573
|
+
execute_script 'mobile: tap', :x => 0.0, :y => 0.98
|
|
1574
|
+
```
|
|
1751
1575
|
|
|
1752
|
-
|
|
1753
|
-
quit and exit are reserved by Pry.
|
|
1576
|
+
https://github.com/appium/appium/wiki/Automating-mobile-gestures
|
|
1754
1577
|
|
|
1755
1578
|
__Returns:__
|
|
1756
1579
|
|
|
1757
|
-
[
|
|
1580
|
+
[OpenStruct] the relative x, y in a struct. ex: { x: 0.50, y: 0.20 }
|
|
1758
1581
|
|
|
1759
1582
|
--
|
|
1760
1583
|
|