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.
Files changed (132) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +17 -8
  3. data/android_tests/Gemfile +1 -0
  4. data/android_tests/LICENSE-2.0.txt +202 -0
  5. data/android_tests/Rakefile +61 -0
  6. data/android_tests/api.apk +0 -0
  7. data/android_tests/appium.txt +3 -0
  8. data/android_tests/flaky.txt +1 -0
  9. data/android_tests/lib/android/specs/android/dynamic.rb +5 -0
  10. data/android_tests/lib/android/specs/android/element/alert.rb +41 -0
  11. data/android_tests/lib/android/specs/android/element/button.rb +55 -0
  12. data/android_tests/lib/android/specs/android/element/generic.rb +48 -0
  13. data/android_tests/lib/android/specs/android/element/text.rb +39 -0
  14. data/android_tests/lib/android/specs/android/element/textfield.rb +60 -0
  15. data/android_tests/lib/android/specs/android/helper.rb +80 -0
  16. data/android_tests/lib/android/specs/android/patch.rb +14 -0
  17. data/android_tests/lib/android/specs/common/device.rb +117 -0
  18. data/android_tests/lib/android/specs/common/element/window.rb +9 -0
  19. data/android_tests/lib/android/specs/common/helper.rb +112 -0
  20. data/android_tests/lib/android/specs/common/patch.rb +69 -0
  21. data/android_tests/lib/android/specs/common/version.rb +9 -0
  22. data/android_tests/lib/android/specs/driver.rb +174 -0
  23. data/android_tests/lib/format.rb +49 -0
  24. data/android_tests/lib/run.rb +72 -0
  25. data/android_tests/readme.md +27 -0
  26. data/appium_lib.gemspec +8 -5
  27. data/docs/android_docs.md +1052 -716
  28. data/docs/ios_docs.md +657 -834
  29. data/docs_gen/make_docs.rb +1 -3
  30. data/ios_tests/Gemfile +1 -0
  31. data/ios_tests/LICENSE-2.0.txt +202 -0
  32. data/ios_tests/Rakefile +47 -0
  33. data/ios_tests/UICatalog.app.zip +0 -0
  34. data/ios_tests/UICatalog.app/12-6AM.png +0 -0
  35. data/ios_tests/UICatalog.app/12-6PM.png +0 -0
  36. data/ios_tests/UICatalog.app/6-12AM.png +0 -0
  37. data/ios_tests/UICatalog.app/6-12PM.png +0 -0
  38. data/ios_tests/UICatalog.app/Default-568h@2x.png +0 -0
  39. data/ios_tests/UICatalog.app/Default@2x.png +0 -0
  40. data/ios_tests/UICatalog.app/Info.plist +0 -0
  41. data/ios_tests/UICatalog.app/PkgInfo +1 -0
  42. data/ios_tests/UICatalog.app/UIButton_custom.png +0 -0
  43. data/ios_tests/UICatalog.app/UICatalog +0 -0
  44. data/ios_tests/UICatalog.app/blueButton.png +0 -0
  45. data/ios_tests/UICatalog.app/bookmarkImage.png +0 -0
  46. data/ios_tests/UICatalog.app/bookmarkImageHighlighted.png +0 -0
  47. data/ios_tests/UICatalog.app/divider.png +0 -0
  48. data/ios_tests/UICatalog.app/en.lproj/AlertsViewController.nib +0 -0
  49. data/ios_tests/UICatalog.app/en.lproj/ButtonsViewController.nib +0 -0
  50. data/ios_tests/UICatalog.app/en.lproj/ControlsViewController.nib +0 -0
  51. data/ios_tests/UICatalog.app/en.lproj/ImagesViewController.nib +0 -0
  52. data/ios_tests/UICatalog.app/en.lproj/Localizable.strings +0 -0
  53. data/ios_tests/UICatalog.app/en.lproj/MainWindow.nib +0 -0
  54. data/ios_tests/UICatalog.app/en.lproj/PickerViewController.nib +0 -0
  55. data/ios_tests/UICatalog.app/en.lproj/SearchBarController.nib +0 -0
  56. data/ios_tests/UICatalog.app/en.lproj/SegmentViewController.nib +0 -0
  57. data/ios_tests/UICatalog.app/en.lproj/TextFieldController.nib +0 -0
  58. data/ios_tests/UICatalog.app/en.lproj/TextViewController.nib +0 -0
  59. data/ios_tests/UICatalog.app/en.lproj/ToolbarViewController.nib +0 -0
  60. data/ios_tests/UICatalog.app/en.lproj/TransitionViewController.nib +0 -0
  61. data/ios_tests/UICatalog.app/en.lproj/WebViewController.nib +0 -0
  62. data/ios_tests/UICatalog.app/orangeslide.png +0 -0
  63. data/ios_tests/UICatalog.app/scene1.jpg +0 -0
  64. data/ios_tests/UICatalog.app/scene2.jpg +0 -0
  65. data/ios_tests/UICatalog.app/scene3.jpg +0 -0
  66. data/ios_tests/UICatalog.app/scene4.jpg +0 -0
  67. data/ios_tests/UICatalog.app/scene5.jpg +0 -0
  68. data/ios_tests/UICatalog.app/searchBarBackground.png +0 -0
  69. data/ios_tests/UICatalog.app/segment_check.png +0 -0
  70. data/ios_tests/UICatalog.app/segment_search.png +0 -0
  71. data/ios_tests/UICatalog.app/segment_tools.png +0 -0
  72. data/ios_tests/UICatalog.app/segmentedBackground.png +0 -0
  73. data/ios_tests/UICatalog.app/slider_ball.png +0 -0
  74. data/ios_tests/UICatalog.app/toolbarBackground.png +0 -0
  75. data/ios_tests/UICatalog.app/whiteButton.png +0 -0
  76. data/ios_tests/UICatalog.app/yellowslide.png +0 -0
  77. data/ios_tests/appium.txt +3 -0
  78. data/ios_tests/flaky.txt +1 -0
  79. data/ios_tests/lib/format.rb +25 -0
  80. data/ios_tests/lib/ios/specs/common/element/window.rb +15 -0
  81. data/ios_tests/lib/ios/specs/common/helper.rb +204 -0
  82. data/ios_tests/lib/ios/specs/common/patch.rb +50 -0
  83. data/ios_tests/lib/ios/specs/common/version.rb +17 -0
  84. data/ios_tests/lib/ios/specs/device/device.rb +82 -0
  85. data/ios_tests/lib/ios/specs/device/multi_touch.rb +12 -0
  86. data/ios_tests/lib/ios/specs/device/touch_actions.rb +15 -0
  87. data/ios_tests/lib/ios/specs/driver.rb +203 -0
  88. data/ios_tests/lib/ios/specs/ios/element/alert.rb +48 -0
  89. data/ios_tests/lib/ios/specs/ios/element/button.rb +58 -0
  90. data/ios_tests/lib/ios/specs/ios/element/generic.rb +35 -0
  91. data/ios_tests/lib/ios/specs/ios/element/text.rb +54 -0
  92. data/ios_tests/lib/ios/specs/ios/element/textfield.rb +123 -0
  93. data/ios_tests/lib/ios/specs/ios/helper.rb +27 -0
  94. data/ios_tests/lib/ios/specs/ios/patch.rb +30 -0
  95. data/ios_tests/lib/run.rb +106 -0
  96. data/ios_tests/readme.md +30 -0
  97. data/ios_tests/upload/sauce_storage.rb +64 -0
  98. data/ios_tests/upload/upload.rb +6 -0
  99. data/lib/appium_lib.rb +4 -14
  100. data/lib/appium_lib/android/dynamic.rb +30 -32
  101. data/lib/appium_lib/android/element/alert.rb +34 -33
  102. data/lib/appium_lib/android/element/button.rb +91 -0
  103. data/lib/appium_lib/android/element/generic.rb +51 -146
  104. data/lib/appium_lib/android/element/text.rb +54 -0
  105. data/lib/appium_lib/android/element/textfield.rb +46 -41
  106. data/lib/appium_lib/android/helper.rb +248 -417
  107. data/lib/appium_lib/android/mobile_methods.rb +17 -0
  108. data/lib/appium_lib/android/patch.rb +9 -8
  109. data/lib/appium_lib/awesome_print/ostruct.rb +33 -0
  110. data/lib/appium_lib/common/element/window.rb +9 -8
  111. data/lib/appium_lib/common/helper.rb +182 -243
  112. data/lib/appium_lib/common/patch.rb +65 -79
  113. data/lib/appium_lib/common/version.rb +2 -3
  114. data/lib/appium_lib/device/device.rb +339 -0
  115. data/lib/appium_lib/device/multi_touch.rb +94 -0
  116. data/lib/appium_lib/device/touch_actions.rb +142 -0
  117. data/lib/appium_lib/driver.rb +217 -306
  118. data/lib/appium_lib/ios/element/alert.rb +16 -92
  119. data/lib/appium_lib/ios/element/button.rb +55 -0
  120. data/lib/appium_lib/ios/element/generic.rb +27 -160
  121. data/lib/appium_lib/ios/element/text.rb +54 -0
  122. data/lib/appium_lib/ios/element/textfield.rb +78 -65
  123. data/lib/appium_lib/ios/helper.rb +300 -190
  124. data/lib/appium_lib/ios/mobile_methods.rb +17 -0
  125. data/lib/appium_lib/ios/patch.rb +55 -41
  126. data/lib/appium_lib/logger.rb +13 -0
  127. data/lib/appium_lib/rails/duplicable.rb +116 -0
  128. data/readme.md +6 -1
  129. data/release_notes.md +118 -0
  130. metadata +170 -12
  131. data/lib/appium_lib/common/element/button.rb +0 -83
  132. data/lib/appium_lib/common/element/text.rb +0 -61
@@ -0,0 +1,69 @@
1
+ =begin
2
+ Skip:
3
+ status # status patches are already tested in driver.rb
4
+ raw_execute # debug output for Pry
5
+ =end
6
+ describe 'common/patch' do
7
+ # Attributes are busted in Android.
8
+ # Blocked on https://github.com/appium/appium/issues/628
9
+ describe 'Selenium::WebDriver::Element methods' do
10
+ # Android supports exactly two string Attributes
11
+ # .name and .text
12
+ # https://github.com/appium/appium/blob/ea3450e7f78d1794bab42fa396a387e7b86fd3b3/android/bootstrap/src/io/appium/android/bootstrap/handler/GetAttribute.java#L43
13
+ # t 'value' do; end # Doesn't work on Android
14
+
15
+ t 'name' do
16
+ wait { first_s_text.name.must_equal 'API Demos' }
17
+ end
18
+
19
+ # t 'tag_name' do; end # Doesn't work on Android
20
+
21
+ t 'location_rel' do
22
+ wait do
23
+ loc = first_s_text.location_rel
24
+ loc.x.class.must_equal String
25
+ loc.y.class.must_equal String
26
+ end
27
+ end
28
+ end
29
+
30
+ describe 'common patch' do
31
+ # By default, the webdriver gem will return message instead of origValue
32
+ # {"message":"An unknown server-side error occurred while processing the command.","origValue":"Strategy id is not valid."}
33
+ t 'id error_message' do
34
+ value = ''
35
+ begin
36
+ set_wait 0
37
+ find_element(:id, 'ok')
38
+ rescue Exception => e;
39
+ value = e.message
40
+ ensure
41
+ set_wait 30
42
+ end
43
+ value = value.split("\n").first.strip
44
+ exp = "Could not find an element using supplied strategy. ID `ok` doesn't exist as text or content desc."
45
+ value.must_equal exp
46
+ end
47
+
48
+ t 'id success' do
49
+ wait do
50
+ el = id 'autocomplete_3_button_7' # <string name="autocomplete_3_button_7">Text</string>
51
+ el.name.must_equal 'Text'
52
+ end
53
+ end
54
+
55
+ t 'find many elements by resource id' do
56
+ wait do
57
+ value = find_elements(:id, 'android:id/text1').length
58
+ value.must_equal 13
59
+ end
60
+ end
61
+
62
+ t 'find single element by resource id' do
63
+ wait do
64
+ value = id('android:id/text1').text
65
+ value.must_equal 'Accessibility'
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,9 @@
1
+ describe 'version.rb' do
2
+ t '::Appium::VERSION' do
3
+ ::Appium::VERSION.must_match /(\d+)\.(\d+).(\d+)/
4
+ end
5
+
6
+ t '::Appium::DATE' do
7
+ ::Appium::DATE.must_match /(\d+)\-(\d+)\-(\d+)/
8
+ end
9
+ end
@@ -0,0 +1,174 @@
1
+ # rake android[driver]
2
+ describe 'driver' do
3
+ def is_sauce
4
+ ENV['UPLOAD_FILE'] && ENV['SAUCE_USERNAME']
5
+ end
6
+
7
+ t 'load_appium_txt' do
8
+ # __FILE__ is '(eval)' so use env var set by the Rakefile
9
+ parsed = Appium.load_appium_txt file: ENV['APPIUM_TXT'], verbose: true
10
+ apk_name = File.basename parsed[:caps][:app]
11
+ assert_equal apk_name, 'api.apk'
12
+ end
13
+
14
+ describe 'Appium::Driver attributes' do
15
+ # attr_reader :default_wait, :app_path, :app_name, :selendroid,
16
+ # :app_package, :app_activity, :app_wait_activity,
17
+ # :sauce_username, :sauce_access_key, :port, :os, :debug
18
+ t 'default_wait attr' do
19
+ set_wait 1
20
+ default_wait.must_equal 1
21
+ set_wait # restore default
22
+ end
23
+
24
+ t 'app_path attr' do
25
+ apk_name = File.basename driver_attributes[:caps][:app]
26
+ apk_name.must_equal 'api.apk'
27
+ end
28
+
29
+ # Only used for Sauce Labs
30
+ t 'verify all attributes' do
31
+ 2.times { set_wait 1 } # must set twice to validate last_waits
32
+ actual = driver_attributes
33
+ actual[:caps][:app] = File.basename actual[:caps][:app]
34
+ expected = { caps: { platformName: 'android',
35
+ app: 'api.apk' },
36
+ custom_url: false,
37
+ export_session: false,
38
+ default_wait: 1,
39
+ last_waits: [1, 1],
40
+ sauce_username: nil,
41
+ sauce_access_key: nil,
42
+ port: 4723,
43
+ device: :android,
44
+ debug: true }
45
+
46
+ actual.must_equal expected
47
+ end
48
+ end
49
+
50
+ describe 'Appium::Driver' do
51
+ t '@@loaded' do
52
+ loaded = $driver.class.class_variable_get :@@loaded
53
+ loaded.must_equal true
54
+ end
55
+
56
+ t '$driver.class' do
57
+ $driver.class.must_equal Appium::Driver
58
+ end
59
+
60
+ t 'absolute_app_path' do
61
+ def absolute_app_path path;
62
+ $driver.class.absolute_app_path path;
63
+ end
64
+
65
+ def validate_path path;
66
+ absolute_app_path(path).must_equal path;
67
+ end
68
+
69
+ validate_path 'sauce-storage:some_storage_suffix'
70
+ validate_path 'http://www.saucelabs.com'
71
+
72
+ # fake real paths for osx/windows.
73
+ FakeFS.activate!
74
+
75
+ osx_existing_path = '/Users/user/myapp.app'
76
+ FileUtils.mkdir_p osx_existing_path
77
+ validate_path osx_existing_path
78
+
79
+ # TODO: FakeFS fails on Windows paths due to the drive letters.
80
+ # Look into how opscode/chef tests this.
81
+ # windows_existing_path = "C:\\Program Files\\myapp.apk"
82
+ # FileUtils.mkdir_p windows_existing_path
83
+ # validate_path windows_existing_path
84
+
85
+ FakeFS.deactivate!
86
+
87
+ # bundle id test
88
+ validate_path 'my.bundle.id'
89
+
90
+ # relative path test
91
+ relative_path = File.join __FILE__, ('..' + File::SEPARATOR) * 4, 'api.apk'
92
+ expected_path = File.expand_path relative_path
93
+
94
+ absolute_app_path(relative_path).must_equal expected_path
95
+
96
+ # invalid path test
97
+ invalid_path_errors = false
98
+ begin
99
+ absolute_app_path('../../does_not_exist.apk')
100
+ rescue Exception
101
+ invalid_path_errors = true
102
+ ensure
103
+ invalid_path_errors.must_equal true
104
+ end
105
+ end
106
+ end
107
+
108
+ describe 'methods' do
109
+ t 'status' do
110
+ appium_server_version['build'].keys.sort.must_equal %w(revision version)
111
+ end
112
+
113
+ t 'server_version' do
114
+ server_version = appium_server_version['build']['version']
115
+ if is_sauce
116
+ server_version.must_match 'Sauce OnDemand'
117
+ else
118
+ server_version.must_match /(\d+)\.(\d+).(\d+)/
119
+ end
120
+ end
121
+
122
+ =begin
123
+ Skip:
124
+ ios_capabilities # save for iOS tests
125
+ absolute_app_path # tested already by starting the driver for this test
126
+ server_url # sauce labs only
127
+ =end
128
+ t 'restart' do
129
+ set_wait 1 # ensure wait is 1 before we restart.
130
+ restart
131
+ current_activity.must_equal '.ApiDemos'
132
+ end
133
+
134
+ t 'driver' do
135
+ driver.browser.must_equal :Android
136
+ end
137
+
138
+ =begin
139
+ Skip:
140
+ screenshot # this is slow and already tested by Appium
141
+ driver_quit # tested by restart
142
+ start_driver # tested by restart
143
+ no_wait # posts value to server, it's not stored locally
144
+ set_wait # posts value to server, it's not stored locally
145
+ execute_script # 'mobile: ' is deprecated and plain executeScript unsupported
146
+ =end
147
+ t 'default_wait' do
148
+ set_wait 1
149
+ default_wait.must_equal 1
150
+ end
151
+
152
+ # returns true unless an error is raised
153
+ t 'exists' do
154
+ exists(0, 0) { true }.must_equal true
155
+ exists(0, 0) { raise 'error' }.must_equal false
156
+ end
157
+
158
+ # any elements
159
+ t 'find_elements' do
160
+ wait do
161
+ find_elements(:class_name, 'android.widget.TextView').length.must_equal 14
162
+ end
163
+ end
164
+
165
+ # any element
166
+ t 'find_element' do
167
+ wait do
168
+ find_element(:class_name, 'android.widget.TextView').class.must_equal Selenium::WebDriver::Element
169
+ end
170
+ end
171
+
172
+ # Skip: x # x is only used in Pry
173
+ end
174
+ end
@@ -0,0 +1,49 @@
1
+ # helper code useful for writing and verifying tests using Pry
2
+ list = <<TXT
3
+ find
4
+ text
5
+ texts
6
+ name
7
+ names
8
+ scroll_to
9
+ TXT
10
+
11
+ list.split("\n").each do |method|
12
+ puts "t '#{method}' do"
13
+ puts
14
+ puts 'end'
15
+ puts
16
+ end
17
+
18
+ # --
19
+
20
+ # Format AndroidElementClassMap from
21
+ # https://github.com/appium/appium/blob/master/android/bootstrap/src/io/appium/android/bootstrap/AndroidElementClassMap.java
22
+ # for ruby_lib android/helper.rb tag_name_to_android
23
+ list = <<TXT
24
+ map.put("abslist", "AbsListView");
25
+ map.put("button", "Button");
26
+ TXT
27
+
28
+ list.split("\n").each do |method|
29
+ pair = method.match /"([^"]+)"[^"]+"([^"]+)"/
30
+ tag = pair[1]
31
+ klass = pair[2]
32
+
33
+ indent = 6
34
+ puts ' ' * indent + "when '" + tag + "'"
35
+ line2 = ' ' * (indent + 2) + "prefix '" + klass + "'"
36
+ # button must translate to both button and image button
37
+ # for ruby_lib to find all buttons
38
+ line2 += ", 'ImageButton'" if klass == 'Button'
39
+ puts line2
40
+ end
41
+
42
+ =begin
43
+ # for Pry
44
+ class Object
45
+ def must_equal b
46
+ raise 'not equal' unless self == b
47
+ end
48
+ end
49
+ =end
@@ -0,0 +1,72 @@
1
+ require 'rubygems'
2
+ require 'spec'
3
+ require 'fakefs/safe'
4
+ require_relative '../../lib/appium_lib'
5
+
6
+ =begin
7
+ Run all Android tests:
8
+ ruby run.rb android
9
+
10
+ Run only the view album test:
11
+ ruby run.rb android view_album
12
+ =end
13
+
14
+ # Sanity check
15
+ a = OpenStruct.new x: 'ok'
16
+ raise 'x issue' unless a.x == 'ok'
17
+
18
+ dir = File.expand_path '..', __FILE__
19
+ device = ARGV[0].downcase.strip
20
+ devices = %w[ android selendroid ios ]
21
+ raise 'Expected android, selendroid or ios as first argument' unless devices.include? device
22
+
23
+ one_test = ARGV[1]
24
+ test_dir = "/#{device}/"
25
+
26
+ caps = Appium.load_appium_txt file: ENV['APPIUM_TXT'], verbose: true
27
+ caps = caps.merge({ appium_lib: { debug: true, wait: 1 } })
28
+ caps[:app] = ENV['SAUCE_PATH'] if ENV['SAUCE_USERNAME'] && ENV['SAUCE_ACCESS_KEY']
29
+
30
+ trace_files = []
31
+
32
+ if one_test
33
+ unless File.exists? one_test
34
+ # ensure ext is .rb
35
+ one_test = File.join(File.dirname(one_test),
36
+ File.basename(one_test, '.*') + '.rb')
37
+ one_test = File.join(dir, test_dir + 'specs/', one_test)
38
+ else
39
+ one_test = File.expand_path one_test
40
+ end
41
+ raise "\nTest #{one_test} does not exist.\n" unless File.exists?(one_test)
42
+ Appium::Driver.new(caps).start_driver
43
+ # require support (common.rb)
44
+ Dir.glob(File.join dir, test_dir + '/*.rb') do |test|
45
+ require test
46
+ trace_files << test
47
+ end
48
+ puts "Loading one test: #{one_test}"
49
+ require one_test
50
+ trace_files << one_test
51
+ else
52
+ # require all
53
+ Dir.glob(File.join dir, test_dir + '**/*.rb') do |test|
54
+ # load all tests
55
+ trace_files << test
56
+ puts " #{File.basename(test, '.*')}"
57
+ require test
58
+ end
59
+ Appium::Driver.new(caps).start_driver
60
+ end
61
+
62
+ trace_files.map! do |f|
63
+ f = File.expand_path f
64
+ # ensure all traced files end in .rb
65
+ f = File.join(File.dirname(f), File.basename(f, '.*') + '.rb')
66
+ f
67
+ end
68
+
69
+ # Exit after tests.
70
+ Minitest.after_run { $driver.x if $driver }
71
+ # Run Minitest. Provide test file array for tracing.
72
+ Minitest.run_specs({ :trace => trace_files })
@@ -0,0 +1,27 @@
1
+ ruby_lib_android
2
+ =====================
3
+
4
+ ruby_lib's Android tests. Requires `Ruby 1.9.3` or better.
5
+
6
+ - `rake install` Install gems required to run the tests.
7
+ - `rake android` Run all tests.
8
+ - `rake android['android/element/generic']` Run a single test.
9
+ - `arc` Opens the Appium Ruby Console (arc). Enables interactive testing.
10
+ - `gem install appium_console` if it's not installed already.
11
+
12
+ api.apk is from [appium/android-apidemos](https://github.com/appium/android-apidemos)
13
+
14
+ #### Documentation
15
+
16
+ - [Installing Appium on OS X](https://github.com/appium/ruby_console/blob/master/osx.md)
17
+ - [Overview](https://github.com/appium/ruby_lib/blob/master/docs/docs.md)
18
+ - [Android methods](https://github.com/appium/ruby_lib/blob/master/docs/android_docs.md)
19
+ - [Minitest Expectations](http://ruby-doc.org/stdlib-1.9.3/libdoc/minitest/spec/rdoc/MiniTest/Expectations.html)
20
+
21
+ --
22
+
23
+ ```java
24
+ Finished in 2 mins 8 secs
25
+
26
+ 94 runs, 120 assertions, 0 failures, 0 errors, 0 skips
27
+ ```
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  def self.add_to_path path
4
2
  path = File.expand_path "../#{path}/", __FILE__
5
3
 
@@ -24,14 +22,19 @@ Gem::Specification.new do |s|
24
22
  s.homepage = 'https://github.com/appium/ruby_lib' # published as appium_lib
25
23
  s.require_paths = [ 'lib' ]
26
24
 
27
- s.add_runtime_dependency 'selenium-webdriver', '~> 2.39', '>= 2.39.0'
25
+ s.add_runtime_dependency 'selenium-webdriver', '~> 2.41', '>= 2.41.0'
28
26
  s.add_runtime_dependency 'awesome_print', '~> 1.2', '>= 1.2.0'
29
27
  s.add_runtime_dependency 'json', '~> 1.8', '>= 1.8.1'
30
28
  s.add_runtime_dependency 'toml', '~> 0.0', '>= 0.0.4'
31
29
  s.add_runtime_dependency 'posix-spawn', '~> 0.3', '>= 0.3.8'
30
+ s.add_runtime_dependency 'nokogiri', '~> 1.6.1'
31
+
32
+ s.add_development_dependency 'hashdiff', '~> 0.2.0'
33
+ s.add_development_dependency 'spec', '~> 5.3.4'
34
+ s.add_development_dependency 'fakefs', '~> 0.5.0'
32
35
 
33
- s.add_development_dependency 'rake', '~> 10.0', '>= 10.0.4'
36
+ s.add_development_dependency 'rake', '~> 10.2', '>= 10.2.2'
34
37
  s.add_development_dependency 'yard', '~> 0.8', '>= 0.8.7.3'
35
38
 
36
39
  s.files = `git ls-files`.split "\n"
37
- end
40
+ end
@@ -1,941 +1,936 @@
1
- ##### [s_texts](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/element/text.rb#L10)
1
+ ##### [load_appium_txt](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L71)
2
2
 
3
- > def s_texts text=nil
3
+ > def self.load_appium_txt opts={}
4
4
 
5
- Get an array of text texts if text is nil else
6
- Get all static textfields that include text.
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
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text to find.
22
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Hash] opts - file: '/path/to/appium.txt', verbose: true
11
23
 
12
24
  __Returns:__
13
25
 
14
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array]
26
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[hash] the symbolized hash with updated :app and :require keys
15
27
 
16
28
  --
17
29
 
18
- ##### [s_texts_names](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/element/text.rb#L18)
30
+ ##### [symbolize_keys](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L141)
19
31
 
20
- > def s_texts_names
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
- ##### [e_s_texts](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/element/text.rb#L24)
41
+ ##### [promote_singleton_appium_methods](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L151)
27
42
 
28
- > def e_s_texts
29
-
30
- Get an array of text elements.
43
+ > def self.promote_singleton_appium_methods main_module
31
44
 
32
- __Returns:__
33
45
 
34
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Text>]
35
46
 
36
47
  --
37
48
 
38
- ##### [first_s_text](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/element/text.rb#L30)
49
+ ##### [promote_appium_methods](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L180)
39
50
 
40
- > def first_s_text
51
+ > def self.promote_appium_methods class_array
41
52
 
42
- Get the first text element.
53
+ Promote appium methods to class instance methods
43
54
 
44
- __Returns:__
55
+ To promote methods to all classes:
45
56
 
46
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Text]
57
+ ```ruby
58
+ Appium.promote_appium_methods Object
59
+ ```
47
60
 
48
- --
61
+ __Parameters:__
49
62
 
50
- ##### [last_s_text](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/element/text.rb#L36)
63
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Class>] class_array - An array of classes
51
64
 
52
- > def last_s_text
65
+ --
53
66
 
54
- Get the last text element
67
+ ##### [global_webdriver_http_sleep](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L213)
55
68
 
56
- __Returns:__
69
+ > def global_webdriver_http_sleep
57
70
 
58
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Text]
71
+ The amount to sleep in seconds before every webdriver http call.
59
72
 
60
73
  --
61
74
 
62
- ##### [s_text](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/element/text.rb#L43)
75
+ ##### [global_webdriver_http_sleep=](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L213)
63
76
 
64
- > def s_text text
77
+ > def global_webdriver_http_sleep=(value)
65
78
 
66
- Get the first element that includes text.
79
+ The amount to sleep in seconds before every webdriver http call.
67
80
 
68
- __Parameters:__
81
+ --
69
82
 
70
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String, Integer] text - the text to find. If int then the text at that index is returned.
83
+ ##### [initialize](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L234)
71
84
 
72
- __Returns:__
85
+ > def initialize opts={}
73
86
 
74
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Text]
87
+ Creates a new driver
75
88
 
76
- --
89
+ ```ruby
90
+ require 'rubygems'
91
+ require 'appium_lib'
77
92
 
78
- ##### [s_text_exact](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/element/text.rb#L51)
93
+ # platformName takes a string or a symbol.
79
94
 
80
- > def s_text_exact text
95
+ # Start iOS driver
96
+ opts = { caps: { platformName: :ios, app: '/path/to/MyiOS.app' } }
97
+ Appium::Driver.new(opts).start_driver
81
98
 
82
- Get the first textfield that matches text.
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
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text that the tag must match
106
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Object] opts - A hash containing various options.
87
107
 
88
108
  __Returns:__
89
109
 
90
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Text]
110
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Driver]
91
111
 
92
112
  --
93
113
 
94
- ##### [s_texts_exact](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/element/text.rb#L58)
114
+ ##### [driver_attributes](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L308)
95
115
 
96
- > def s_texts_exact text
116
+ > def driver_attributes
97
117
 
98
- Get all static textfields that matches text.
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
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text that the tag must match
103
127
 
104
128
  __Returns:__
105
129
 
106
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Text>]
130
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Boolean]
107
131
 
108
132
  --
109
133
 
110
- ##### [window_size](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/element/window.rb#L5)
134
+ ##### [appium_server_version](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L344)
111
135
 
112
- > def window_size
136
+ > def appium_server_version
113
137
 
114
- Get the window's size
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
- ##### [button](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/element/button.rb#L8)
149
+ __Returns:__
119
150
 
120
- > def button text, number=0
151
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Hash]
121
152
 
122
- Find a button by text and optionally number.
153
+ --
123
154
 
124
- __Parameters:__
155
+ ##### [absolute_app_path](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L350)
125
156
 
126
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String, Integer] text - the text to exactly match. If int then the button at that index is returned.
157
+ > def self.absolute_app_path app_path
127
158
 
128
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Integer] number - the occurrence of the button matching text. Defaults to the first button.
159
+ Converts app_path to an absolute path.
129
160
 
130
161
  __Returns:__
131
162
 
132
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Button] the button found with text and matching number
163
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] APP_PATH as an absolute path
133
164
 
134
165
  --
135
166
 
136
- ##### [buttons](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/element/button.rb#L19)
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
- Get an array of button texts or button elements if text is provided.
141
-
142
- __Parameters:__
169
+ > def server_url
143
170
 
144
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text to exactly match
171
+ Get the server url
145
172
 
146
173
  __Returns:__
147
174
 
148
- &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.
175
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] the server url
149
176
 
150
177
  --
151
178
 
152
- ##### [first_button](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/element/button.rb#L26)
179
+ ##### [restart](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L385)
153
180
 
154
- > def first_button
181
+ > def restart
155
182
 
156
- Get the first button element.
183
+ Restarts the driver
157
184
 
158
185
  __Returns:__
159
186
 
160
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Button]
187
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Driver] the driver
161
188
 
162
189
  --
163
190
 
164
- ##### [last_button](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/element/button.rb#L32)
191
+ ##### [driver](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L392)
165
192
 
166
- > def last_button
193
+ > def driver
167
194
 
168
- Get the last button element.
195
+ Returns the driver
169
196
 
170
197
  __Returns:__
171
198
 
172
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Button]
199
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Driver] the driver
173
200
 
174
201
  --
175
202
 
176
- ##### [button_exact](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/element/button.rb#L39)
203
+ ##### [screenshot](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L402)
177
204
 
178
- > def button_exact text
205
+ > def screenshot png_save_path
206
+
207
+ Takes a png screenshot and saves to the target path.
179
208
 
180
- Get the first button element that exactly matches text.
209
+ Example: screenshot '/tmp/hi.png'
181
210
 
182
211
  __Parameters:__
183
212
 
184
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text to match exactly
213
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] png_save_path - the full path to save the png
185
214
 
186
215
  __Returns:__
187
216
 
188
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Button]
217
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[nil]
189
218
 
190
219
  --
191
220
 
192
- ##### [buttons_exact](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/element/button.rb#L46)
193
-
194
- > def buttons_exact text
221
+ ##### [driver_quit](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L409)
195
222
 
196
- Get all button elements that exactly match text.
197
-
198
- __Parameters:__
223
+ > def driver_quit
199
224
 
200
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text to match exactly
225
+ Quits the driver
201
226
 
202
227
  __Returns:__
203
228
 
204
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Button>]
229
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[void]
205
230
 
206
231
  --
207
232
 
208
- ##### [e_buttons](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/element/button.rb#L52)
233
+ ##### [start_driver](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L417)
209
234
 
210
- > def e_buttons
235
+ > def start_driver
211
236
 
212
- Get an array of button elements.
237
+ Creates a new global driver and quits the old one if it exists.
213
238
 
214
239
  __Returns:__
215
240
 
216
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Button>]
241
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Selenium::WebDriver] the new global driver
217
242
 
218
243
  --
219
244
 
220
- ##### [button_num](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/element/button.rb#L72)
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
- > def button_num text, number=1
251
+ --
223
252
 
224
- Expected to be called via button method.
253
+ ##### [set_wait](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L462)
225
254
 
226
- Get the button element exactly matching text and
227
- occurrence. number=2 means the 2nd occurrence.
255
+ > def set_wait timeout=nil
228
256
 
229
- find the second Sign In button
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
- b = e_button 'Sign In', 2
261
+ ```ruby`
262
+ set_wait 2
263
+ set_wait 3
264
+ set_wait # 2
232
265
 
233
- Button order will change in iOS vs Android
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
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text to match
240
-
241
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Integer] number - the button occurance to return. 1 = first button
270
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Integer] timeout - the timeout in seconds
242
271
 
243
272
  __Returns:__
244
273
 
245
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Button] the button that matches text and number
274
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[void]
246
275
 
247
276
  --
248
277
 
249
- ##### [tag_name_to_android](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/android/helper.rb#L6) android
278
+ ##### [default_wait](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L480)
250
279
 
251
- > def tag_name_to_android tag_name
252
-
253
- Returns an array of android classes that match the tag name
254
-
255
- __Parameters:__
280
+ > def default_wait
256
281
 
257
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] tag_name - the tag name to convert to an android class
282
+ Returns the default client side wait.
283
+ This value is independent of what the server is using
258
284
 
259
285
  __Returns:__
260
286
 
261
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String]
287
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Integer]
262
288
 
263
289
  --
264
290
 
265
- ##### [find_eles_attr](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/android/helper.rb#L198) android
291
+ ##### [exists](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L496)
266
292
 
267
- > def find_eles_attr tag_name, attribute=nil
293
+ > def exists pre_check=0, post_check=@default_wait, &search_block
268
294
 
269
- Find all elements matching the attribute
270
- On android, assume the attr is name (which falls back to text).
295
+ Returns existence of element.
271
296
 
272
- ```ruby
273
- find_eles_attr :text
274
- ```
297
+ Example:
298
+
299
+ exists { button('sign in') } ? puts('true') : puts('false')
275
300
 
276
301
  __Parameters:__
277
302
 
278
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] tag_name - the tag name to search for
303
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Integer] pre_check - the amount in seconds to set the
304
+ wait to before checking existance
305
+
306
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Integer] post_check - the amount in seconds to set the
307
+ wait to after checking existance
308
+
309
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Block] search_block - the block to call
279
310
 
280
311
  __Returns:__
281
312
 
282
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
313
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Boolean]
283
314
 
284
315
  --
285
316
 
286
- ##### [get_selendroid_inspect](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/android/helper.rb#L220) android
317
+ ##### [execute_script](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L520)
287
318
 
288
- > def get_selendroid_inspect
319
+ > def execute_script script, *args
289
320
 
290
- Selendroid only.
291
- Returns a string containing interesting elements.
321
+ The same as @driver.execute_script
322
+
323
+ __Parameters:__
324
+
325
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] script - the script to execute
326
+
327
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[*args] args - the args to pass to the script
292
328
 
293
329
  __Returns:__
294
330
 
295
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String]
331
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Object]
296
332
 
297
333
  --
298
334
 
299
- ##### [get_page_class](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/android/helper.rb#L282) android
300
-
301
- > def get_page_class
335
+ ##### [find_elements](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L528)
302
336
 
337
+ > def find_elements *args
303
338
 
339
+ Calls @driver.find_elements
304
340
 
305
- --
341
+ __Parameters:__
306
342
 
307
- ##### [page_class](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/android/helper.rb#L310) android
343
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[*args] args - the args to use
308
344
 
309
- > def page_class
345
+ __Returns:__
310
346
 
311
- Count all classes on screen and print to stdout.
312
- Useful for appium_console.
347
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Element>] Array is empty when no elements are found.
313
348
 
314
349
  --
315
350
 
316
- ##### [get_android_inspect](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/android/helper.rb#L319) android
351
+ ##### [find_element](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L536)
352
+
353
+ > def find_element *args
317
354
 
318
- > def get_android_inspect
355
+ Calls @driver.find_elements
319
356
 
320
- Android only.
321
- Returns a string containing interesting elements.
322
- If an element has no content desc or text, then it's not returned by this method.
357
+ __Parameters:__
358
+
359
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[*args] args - the args to use
323
360
 
324
361
  __Returns:__
325
362
 
326
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String]
363
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
327
364
 
328
365
  --
329
366
 
330
- ##### [get_inspect](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/android/helper.rb#L403) android
367
+ ##### [x](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/driver.rb#L543)
331
368
 
332
- > def get_inspect
369
+ > def x
333
370
 
334
- Automatically detects selendroid or android.
335
- Returns a string containing interesting elements.
371
+ Quit the driver and Pry.
372
+ quit and exit are reserved by Pry.
336
373
 
337
374
  __Returns:__
338
375
 
339
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String]
376
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[void]
340
377
 
341
378
  --
342
379
 
343
- ##### [page](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/android/helper.rb#L409) android
380
+ ##### [NoArgMethods](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L7)
344
381
 
345
- > def page
382
+ > NoArgMethods = {
346
383
 
347
- Intended for use with console.
348
- Inspects and prints the current page.
349
384
 
350
- --
351
385
 
352
- ##### [fast_duration](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/android/helper.rb#L421) android
386
+ --
353
387
 
354
- > def fast_duration
388
+ ##### [app_strings](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L23)
355
389
 
356
- JavaScript code from https://github.com/appium/appium/blob/master/app/android.js
390
+ > def app_strings
357
391
 
358
- ```javascript
359
- Math.round(1.0/28.0 * 28) = 1
392
+ Return the hash of all localization strings.
393
+ ```ruby
394
+ app_strings #=> "TransitionsTitle"=>"Transitions", "WebTitle"=>"Web"
360
395
  ```
361
396
 
362
- We want steps to be exactly 1. If it's zero then a tap is used instead of a swipe.
363
-
364
397
  --
365
398
 
366
- ##### [current_app](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/android/helper.rb#L427) android
399
+ ##### [background_app](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L29)
367
400
 
368
- > def current_app
401
+ > def background_app
369
402
 
370
- Lists package, activity, and adb shell am start -n value for current app.
371
- Works on local host only (not remote).
403
+ Backgrounds the app for a set number of seconds.
404
+ This is a blocking application
372
405
 
373
406
  --
374
407
 
375
- ##### [id](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/android/helper.rb#L441) android
408
+ ##### [current_activity](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L34)
376
409
 
377
- > def id id
410
+ > def current_activity
378
411
 
379
- Find by id. Useful for selendroid
380
412
 
381
- __Parameters:__
382
413
 
383
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] id - the id to search for
414
+ --
384
415
 
385
- __Returns:__
416
+ ##### [launch](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L36)
386
417
 
387
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
418
+ > def launch
419
+
420
+ Start the simulator and applicaton configured with desired capabilities
388
421
 
389
422
  --
390
423
 
391
- ##### [alert_click](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/android/element/alert.rb#L6) android
424
+ ##### [reset](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L39)
392
425
 
393
- > def alert_click value
426
+ > def reset
394
427
 
395
- Tap the alert button identified by value.
428
+ Reset the device, relaunching the application.
396
429
 
397
- __Parameters:__
430
+ --
398
431
 
399
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Integer, String] value - either an integer index of the button or the button's name
432
+ ##### [shake](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L42)
400
433
 
401
- __Returns:__
434
+ > def shake
402
435
 
403
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[void]
436
+ Cause the device to shake
404
437
 
405
438
  --
406
439
 
407
- ##### [alert_accept](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/android/element/alert.rb#L13) android
440
+ ##### [toggle_flight_mode](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L45)
408
441
 
409
- > def alert_accept
442
+ > def toggle_flight_mode
410
443
 
411
- Accept the alert.
412
- The last button is considered "accept."
444
+ toggle flight mode on or off
413
445
 
414
- __Returns:__
446
+ --
415
447
 
416
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[void]
448
+ ##### [complex_find](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L48)
417
449
 
418
- --
450
+ > def complex_find
419
451
 
420
- ##### [alert_accept_text](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/android/element/alert.rb#L20) android
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.
421
455
 
422
- > def alert_accept_text
456
+ ```ruby
457
+ complex_find [[[2, 'Sau'], [14, true]]] # => Find a clickable element
458
+ # whose names starts with 'Sau'
459
+ ```
423
460
 
424
- Get the text of the alert's accept button.
425
- The last button is considered "accept."
461
+ __Parameters:__
426
462
 
427
- __Returns:__
463
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Symbol] mod - If present, will be the 0th element in the selector array.
428
464
 
429
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String]
465
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Object>] selectors - The selectors to find elements with.
430
466
 
431
467
  --
432
468
 
433
- ##### [alert_dismiss](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/android/element/alert.rb#L27) android
469
+ ##### [hide_keyboard](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L60)
434
470
 
435
- > def alert_dismiss
471
+ > def hide_keyboard
436
472
 
437
- Dismiss the alert.
438
- The first button is considered "dismiss."
473
+ Hide the onscreen keyboard
439
474
 
440
- __Returns:__
475
+ __Parameters:__
441
476
 
442
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[void]
477
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] close_key - the name of the key which closes the keyboard.
478
+ Defaults to 'Done'.
443
479
 
444
480
  --
445
481
 
446
- ##### [alert_dismiss_text](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/android/element/alert.rb#L34) android
482
+ ##### [key_event](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L69)
447
483
 
448
- > def alert_dismiss_text
484
+ > def key_event
449
485
 
450
- Get the text of the alert's dismiss button.
451
- The first button is considered "dismiss."
486
+ Send a key event to the device.
452
487
 
453
- __Returns:__
488
+ __Parameters:__
454
489
 
455
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String]
490
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[integer] key - The key to send.
491
+
492
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] metastate - The state the metakeys should be in when sending the key.
456
493
 
457
494
  --
458
495
 
459
- ##### [find](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/android/element/generic.rb#L44) android
496
+ ##### [push_file](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L74)
460
497
 
461
- > def find val
498
+ > def push_file
462
499
 
463
- Find the value contained in content description or text. Search elements
464
- in this order: EditText, Button, ImageButton
500
+ Place a file in a specific location on the device.
465
501
 
466
502
  __Parameters:__
467
503
 
468
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] val - the value to search for
469
-
470
- __Returns:__
504
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] path - The absolute path on the device to store data at.
471
505
 
472
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
506
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] data - Raw file data to be sent to the device.
473
507
 
474
508
  --
475
509
 
476
- ##### [text](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/android/element/generic.rb#L70) android
510
+ ##### [pull_file](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L79)
477
511
 
478
- > def text text
512
+ > def pull_file
479
513
 
480
- Return the first element matching text.
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
+ ```
481
520
 
482
521
  __Parameters:__
483
522
 
484
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text to search for
485
-
486
- __Returns:__
487
-
488
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element] the first matching element
523
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] path - Either an absolute path OR, for iOS devices, a path relative to the app, as described.
489
524
 
490
525
  --
491
526
 
492
- ##### [texts](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/android/element/generic.rb#L79) android
493
-
494
- > def texts text
527
+ ##### [extend_search_contexts](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L277)
495
528
 
496
- Return all elements matching text.
529
+ > def extend_search_contexts
497
530
 
498
- __Parameters:__
499
531
 
500
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text to search for
501
532
 
502
- __Returns:__
533
+ --
503
534
 
504
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Element>] all matching elements
535
+ ##### [accessiblity_id_find](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L277)
505
536
 
506
- --
537
+ > def accessiblity_id_find
507
538
 
508
- ##### [name](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/android/element/generic.rb#L88) android
539
+ find_element/s with their accessibility_id
509
540
 
510
- > def name name
541
+ ```ruby
542
+ find_elements :accessibility_id, 'Animation'
543
+ ```
511
544
 
512
- Return the first element matching name.
513
- on Android name is content description
514
- on iOS name is the accessibility label or the text.
545
+ --
515
546
 
516
- __Parameters:__
547
+ ##### [add_touch_actions](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L283)
517
548
 
518
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] name - the name to search for
549
+ > def add_touch_actions
519
550
 
520
- __Returns:__
521
551
 
522
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element] the first matching element
523
552
 
524
553
  --
525
554
 
526
- ##### [name_exact](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/android/element/generic.rb#L99) android
555
+ ##### [current_context=](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L307)
527
556
 
528
- > def name_exact name
557
+ > def current_context=
529
558
 
530
- Return the first element exactly matching name.
531
- on Android name is content description
532
- on iOS name is the accessibility label or the text.
559
+ Change the context to the given context.
560
+ ```ruby
561
+ current_context= "NATIVE_APP"
562
+ ```
533
563
 
534
564
  __Parameters:__
535
565
 
536
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] name - the name to search for
537
-
538
- __Returns:__
539
-
540
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element] the first matching element
566
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] The - context to change to
541
567
 
542
568
  --
543
569
 
544
- ##### [names](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/android/element/generic.rb#L117) android
570
+ ##### [current_context](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L315)
545
571
 
546
- > def names name=''
572
+ > def current_context
547
573
 
548
- Return all elements matching name.
549
- on Android name is content description
550
- on iOS name is the accessibility label or the text.
551
574
 
552
- __Parameters:__
553
-
554
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] name - the name to search for
555
575
 
556
576
  __Returns:__
557
577
 
558
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Element>] all matching elements
578
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] The context currently being used.
559
579
 
560
580
  --
561
581
 
562
- ##### [scroll_to](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/android/element/generic.rb#L131) android
563
-
564
- > def scroll_to text
582
+ ##### [available_contexts](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L318)
565
583
 
566
- Scroll to an element containing target text or description.
584
+ > def available_contexts
567
585
 
568
- __Parameters:__
569
586
 
570
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text to search for in the text value and content description
571
587
 
572
588
  __Returns:__
573
589
 
574
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element] the element scrolled to
590
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<String>] All usable contexts, as an array of strings.
575
591
 
576
592
  --
577
593
 
578
- ##### [scroll_to_exact](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/android/element/generic.rb#L144) android
594
+ ##### [within_context](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L328)
579
595
 
580
- > def scroll_to_exact text
596
+ > def within_context(context)
581
597
 
582
- Scroll to an element with the exact target text or description.
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
+ ```
583
603
 
584
604
  __Parameters:__
585
605
 
586
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text to search for in the text value and content description
587
-
588
- __Returns:__
589
-
590
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element] the element scrolled to
606
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] context - The context to switch to for the duration of the block.
591
607
 
592
608
  --
593
609
 
594
- ##### [textfields](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/android/element/textfield.rb#L7) android
595
-
596
- > def textfields
610
+ ##### [switch_to_default_context](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/device.rb#L335)
597
611
 
598
- Get an array of textfield texts.
612
+ > def switch_to_default_context
599
613
 
600
- __Returns:__
601
-
602
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<String>]
614
+ Change to the default context. This is equivalent to `current_context= nil`.
603
615
 
604
616
  --
605
617
 
606
- ##### [e_textfields](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/android/element/textfield.rb#L13) android
618
+ ##### [pinch](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/multi_touch.rb#L30)
607
619
 
608
- > def e_textfields
620
+ > def pinch(percentage=25, auto_perform=true)
621
+
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.
627
+ ```
609
628
 
610
- Get an array of textfield elements.
629
+ __Parameters:__
611
630
 
612
- __Returns:__
631
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[int] percentage - The percent size by which to shrink the screen when pinched.
613
632
 
614
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Textfield>]
633
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[boolean] auto_perform - Whether to perform the action immediately (default true)
615
634
 
616
635
  --
617
636
 
618
- ##### [first_textfield](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/android/element/textfield.rb#L19) android
637
+ ##### [zoom](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/multi_touch.rb#L58)
619
638
 
620
- > def first_textfield
639
+ > def zoom(percentage=200, auto_perform=true)
621
640
 
622
- Get the first textfield element.
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
+ ```
623
647
 
624
- __Returns:__
648
+ __Parameters:__
649
+
650
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[int] percentage - The percent size by which to shrink the screen when pinched.
625
651
 
626
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Textfield]
652
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[boolean] auto_perform - Whether to perform the action immediately (default true)
627
653
 
628
654
  --
629
655
 
630
- ##### [last_textfield](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/android/element/textfield.rb#L25) android
656
+ ##### [initialize](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/multi_touch.rb#L79)
631
657
 
632
- > def last_textfield
658
+ > def initialize
633
659
 
634
- Get the last textfield element.
660
+ Create a new multi-action
635
661
 
636
662
  __Returns:__
637
663
 
638
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Textfield]
664
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[MultiTouch] a new instance of MultiTouch
639
665
 
640
666
  --
641
667
 
642
- ##### [textfield](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/android/element/textfield.rb#L32) android
668
+ ##### [add](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/multi_touch.rb#L85)
643
669
 
644
- > def textfield text
670
+ > def add(chain)
645
671
 
646
- Get the first textfield that includes text or name (content description).
672
+ Add a touch_action to be performed
647
673
 
648
674
  __Parameters:__
649
675
 
650
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String, Integer] text - the text to search for. If int then the textfield at that index is returned.
651
-
652
- __Returns:__
653
-
654
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Textfield]
676
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[TouchAction] chain - The action to add to the chain
655
677
 
656
678
  --
657
679
 
658
- ##### [textfield_exact](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/android/element/textfield.rb#L45) android
680
+ ##### [perform](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/multi_touch.rb#L90)
659
681
 
660
- > def textfield_exact text
682
+ > def perform
661
683
 
662
- Get the first textfield that matches text.
684
+ Ask Appium to perform the actions
663
685
 
664
- __Parameters:__
686
+ --
665
687
 
666
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text to match
688
+ ##### [ACTIONS](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/touch_actions.rb#L12)
689
+
690
+ > ACTIONS = [:move_to, :press_for_duration, :press, :release, :tap, :wait, :perform]
667
691
 
668
- __Returns:__
669
692
 
670
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Textfield]
671
693
 
672
694
  --
673
695
 
674
- ##### [wait](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L33)
696
+ ##### [COMPLEX_ACTIONS](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/touch_actions.rb#L13)
675
697
 
676
- > def wait max_wait=30, interval=0.5, &block
698
+ > COMPLEX_ACTIONS = [:swipe]
677
699
 
678
- Check every 0.5 seconds to see if block.call doesn't raise an exception.
679
- if .call raises an exception then it will be tried again.
680
- if .call doesn't raise an exception then it will stop waiting.
681
700
 
682
- Example: wait { name('back').click }
683
701
 
684
- Give up after 30 seconds.
702
+ --
685
703
 
686
- __Parameters:__
704
+ ##### [actions](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/touch_actions.rb#L27)
687
705
 
688
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Integer] max_wait - the maximum time in seconds to wait for.
689
- Note that max wait 0 means infinity.
706
+ > def actions
690
707
 
691
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Float] interval - the time in seconds to wait after calling the block
708
+ Returns the value of attribute actions
692
709
 
693
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Block] block - the block to call
710
+ --
694
711
 
695
- __Returns:__
712
+ ##### [initialize](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/touch_actions.rb#L29)
696
713
 
697
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Object] the result of block.call
714
+ > def initialize
698
715
 
699
- --
700
716
 
701
- ##### [ignore](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L45)
702
717
 
703
- > def ignore &block
718
+ __Returns:__
704
719
 
705
- Return block.call and ignore any exceptions.
720
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[TouchAction] a new instance of TouchAction
706
721
 
707
722
  --
708
723
 
709
- ##### [wait_true](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L55)
724
+ ##### [move_to](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/touch_actions.rb#L37)
710
725
 
711
- > def wait_true max_wait=30, interval=0.5, &block
726
+ > def move_to(opts)
712
727
 
713
- Check every 0.5 seconds to see if block.call returns true. nil is considered a failure.
714
- Give up after 30 seconds.
728
+ Move to the given co-ordinates.
715
729
 
716
730
  __Parameters:__
717
731
 
718
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Integer] max_wait - the maximum time in seconds to wait for
719
-
720
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Float] interval - the time in seconds to wait after calling the block
721
-
722
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Block] block - the block to call
723
-
724
- __Returns:__
725
-
726
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Object] the result of block.call
732
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Hash] opts - a customizable set of options
727
733
 
728
734
  --
729
735
 
730
- ##### [back](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L68)
736
+ ##### [press_for_duration](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/touch_actions.rb#L47)
731
737
 
732
- > def back
733
-
734
- Navigate back.
738
+ > def press_for_duration(element, x, y, duration)
735
739
 
736
- __Returns:__
740
+ Press down for a specific duration.
737
741
 
738
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[void]
742
+ __Parameters:__
739
743
 
740
- --
744
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[WebDriver::Element] element - the element to press.
741
745
 
742
- ##### [session_id](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L73)
746
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[integer] x - x co-ordinate to press on.
743
747
 
744
- > def session_id
748
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[integer] y - y co-ordinate to press on.
745
749
 
746
- For Sauce Labs reporting. Returns the current session id.
750
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[integer] duration - Number of seconds to press.
747
751
 
748
752
  --
749
753
 
750
- ##### [xpath](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L81)
754
+ ##### [press](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/touch_actions.rb#L58)
751
755
 
752
- > def xpath xpath_str
756
+ > def press(opts)
753
757
 
754
- Returns the first element that matches the provided xpath.
758
+ Press a finger onto the screen. Finger will stay down until you call
759
+ `release`.
755
760
 
756
761
  __Parameters:__
757
762
 
758
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] xpath_str - the XPath string
759
-
760
- __Returns:__
761
-
762
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
763
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Hash] opts - a customizable set of options
763
764
 
764
765
  --
765
766
 
766
- ##### [xpaths](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L89)
767
+ ##### [release](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/touch_actions.rb#L69)
767
768
 
768
- > def xpaths xpath_str
769
+ > def release(opts=nil)
769
770
 
770
- Returns all elements that match the provided xpath.
771
+ Remove a finger from the screen.
771
772
 
772
773
  __Parameters:__
773
774
 
774
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] xpath_str - the XPath string
775
-
776
- __Returns:__
777
-
778
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Element>]
775
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Hash] opts - a customizable set of options
779
776
 
780
777
  --
781
778
 
782
- ##### [ele_index](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L97)
779
+ ##### [tap](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/touch_actions.rb#L80)
783
780
 
784
- > def ele_index tag_name, index
781
+ > def tap(opts)
785
782
 
786
- Get the element of type tag_name at matching index.
783
+ Touch a point on the screen
787
784
 
788
785
  __Parameters:__
789
786
 
790
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] tag_name - the tag name to find
791
-
792
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Integer] index - the index
793
-
794
- __Returns:__
795
-
796
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element] the found element of type tag_name
787
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Hash] opts - a customizable set of options
797
788
 
798
789
  --
799
790
 
800
- ##### [find_eles](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L106)
791
+ ##### [wait](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/touch_actions.rb#L88)
801
792
 
802
- > def find_eles tag_name
793
+ > def wait(seconds)
803
794
 
804
- Get all elements exactly matching tag name
795
+ Pause for a number of seconds before the next action
805
796
 
806
797
  __Parameters:__
807
798
 
808
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] tag_name - the tag name to find
809
-
810
- __Returns:__
811
-
812
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Element>] the found elements of type tag_name
799
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[integer] seconds - Number of seconds to pause for
813
800
 
814
801
  --
815
802
 
816
- ##### [find_ele_by_text](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L114)
803
+ ##### [swipe](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/touch_actions.rb#L99)
817
804
 
818
- > def find_ele_by_text tag, text
805
+ > def swipe(opts)
819
806
 
820
- Get the first tag that exactly matches tag and text.
807
+ Convenience method to peform a swipe.
821
808
 
822
809
  __Parameters:__
823
810
 
824
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] tag - the tag name to match
811
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Hash] opts - a customizable set of options
812
+
813
+ --
825
814
 
826
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text to exactly match
815
+ ##### [perform](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/touch_actions.rb#L114)
827
816
 
828
- __Returns:__
817
+ > def perform
829
818
 
830
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element] the element of type tag exactly matching text
819
+ Ask the driver to perform all actions in this action chain.
831
820
 
832
821
  --
833
822
 
834
- ##### [find_eles_by_text](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L122)
823
+ ##### [cancel](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/touch_actions.rb#L120)
835
824
 
836
- > def find_eles_by_text tag, text
825
+ > def cancel
837
826
 
838
- Get all tags that exactly match tag and text.
827
+ Does nothing, currently.
839
828
 
840
- __Parameters:__
829
+ --
841
830
 
842
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] tag - the tag name to match
831
+ ##### [chain_method](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/touch_actions.rb#L128)
843
832
 
844
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text to exactly match
833
+ > def chain_method(method, args=nil)
845
834
 
846
- __Returns:__
847
835
 
848
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Element>] the elements of type tag exactly matching text
849
836
 
850
837
  --
851
838
 
852
- ##### [find_ele_by_attr_include](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L131)
839
+ ##### [args_with_ele_ref](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/device/touch_actions.rb#L137)
853
840
 
854
- > def find_ele_by_attr_include tag, attr, value
841
+ > def args_with_ele_ref(args)
855
842
 
856
- Get the first tag by attribute that exactly matches value.
857
843
 
858
- __Parameters:__
859
844
 
860
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] tag - the tag name to match
845
+ --
861
846
 
862
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] attr - the attribute to compare
847
+ ##### [wait](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L33)
863
848
 
864
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] value - the value of the attribute that the element must include
849
+ > def wait max_wait=30, interval=0.5, &block
865
850
 
866
- __Returns:__
851
+ Check every 0.5 seconds to see if block.call doesn't raise an exception.
852
+ if .call raises an exception then it will be tried again.
853
+ if .call doesn't raise an exception then it will stop waiting.
867
854
 
868
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element] the element of type tag who's attribute includes value
855
+ Example: wait { name('back').click }
869
856
 
870
- --
857
+ Give up after 30 seconds.
858
+
859
+ __Parameters:__
871
860
 
872
- ##### [find_eles_by_attr_include](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L140)
861
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Integer] max_wait - the maximum time in seconds to wait for.
862
+ Note that max wait 0 means infinity.
873
863
 
874
- > def find_eles_by_attr_include tag, attr, value
864
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Float] interval - the time in seconds to wait after calling the block
875
865
 
876
- Get tags by attribute that include value.
866
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Block] block - the block to call
877
867
 
878
- __Parameters:__
868
+ __Returns:__
879
869
 
880
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] tag - the tag name to match
870
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Object] the result of block.call
881
871
 
882
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] attr - the attribute to compare
872
+ --
883
873
 
884
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] value - the value of the attribute that the element must include
874
+ ##### [ignore](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L49)
885
875
 
886
- __Returns:__
876
+ > def ignore &block
887
877
 
888
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Element>] the elements of type tag who's attribute includes value
878
+ Return block.call and ignore any exceptions.
889
879
 
890
880
  --
891
881
 
892
- ##### [find_ele_by_text_include](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L149)
882
+ ##### [wait_true](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L64)
893
883
 
894
- > def find_ele_by_text_include tag, text
884
+ > def wait_true max_wait=30, interval=0.5, &block
895
885
 
896
- Get the first tag that includes text.
897
- element.attribute(:text).include? text
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.
889
+ Give up after 30 seconds.
898
890
 
899
891
  __Parameters:__
900
892
 
901
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] tag - the tag name to match
893
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Integer] max_wait - the maximum time in seconds to wait for
894
+
895
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Float] interval - the time in seconds to wait after calling the block
902
896
 
903
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text the element must include
897
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Block] block - the block to call
904
898
 
905
899
  __Returns:__
906
900
 
907
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element] the element of type tag that includes text
901
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Object] the result of block.call
908
902
 
909
903
  --
910
904
 
911
- ##### [find_eles_by_text_include](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L158)
905
+ ##### [back](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L81)
912
906
 
913
- > def find_eles_by_text_include tag, text
907
+ > def back
914
908
 
915
- Get the tags that include text.
916
- element.attribute(:text).include? text
909
+ Navigate back.
917
910
 
918
- __Parameters:__
911
+ __Returns:__
919
912
 
920
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] tag - the tag name to match
913
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[void]
921
914
 
922
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text the element must include
915
+ --
923
916
 
924
- __Returns:__
917
+ ##### [session_id](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L86)
925
918
 
926
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Element>] the elements of type tag that includes text
919
+ > def session_id
920
+
921
+ For Sauce Labs reporting. Returns the current session id.
927
922
 
928
923
  --
929
924
 
930
- ##### [first_ele](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L165)
925
+ ##### [xpath](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L94)
931
926
 
932
- > def first_ele tag_name
927
+ > def xpath xpath_str
933
928
 
934
- Get the first tag that matches tag_name
929
+ Returns the first element that matches the provided xpath.
935
930
 
936
931
  __Parameters:__
937
932
 
938
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] tag_name - the tag to match
933
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] xpath_str - the XPath string
939
934
 
940
935
  __Returns:__
941
936
 
@@ -943,27 +938,27 @@ __Returns:__
943
938
 
944
939
  --
945
940
 
946
- ##### [last_ele](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L173)
941
+ ##### [xpaths](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L102)
947
942
 
948
- > def last_ele tag_name
943
+ > def xpaths xpath_str
949
944
 
950
- Get the last tag that matches tag_name
945
+ Returns all elements that match the provided xpath.
951
946
 
952
947
  __Parameters:__
953
948
 
954
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] tag_name - the tag to match
949
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] xpath_str - the XPath string
955
950
 
956
951
  __Returns:__
957
952
 
958
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
953
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Element>]
959
954
 
960
955
  --
961
956
 
962
- ##### [source](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L179)
957
+ ##### [source](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L108)
963
958
 
964
959
  > def source
965
960
 
966
- Prints a JSON view of the current page
961
+ Prints xml of the current page
967
962
 
968
963
  __Returns:__
969
964
 
@@ -971,83 +966,81 @@ __Returns:__
971
966
 
972
967
  --
973
968
 
974
- ##### [get_source](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L185)
969
+ ##### [get_source](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L118)
975
970
 
976
971
  > def get_source
977
972
 
978
- Gets a JSON view of the current page
973
+ Returns XML string for the current page
974
+ Same as driver.page_source
979
975
 
980
976
  __Returns:__
981
977
 
982
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[JSON]
978
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String]
983
979
 
984
980
  --
985
981
 
986
- ##### [find_name](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L194)
982
+ ##### [result](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L125)
987
983
 
988
- > def find_name name
984
+ > def result
989
985
 
990
- Returns the first element that exactly matches name
986
+ Returns the value of attribute result
991
987
 
992
- __Parameters:__
988
+ --
993
989
 
994
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] name - the name to exactly match
990
+ ##### [initialize](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L127)
995
991
 
996
- __Returns:__
992
+ > def initialize
997
993
 
998
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
999
994
 
1000
- --
1001
995
 
1002
- ##### [find_names](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L202)
996
+ __Returns:__
1003
997
 
1004
- > def find_names name
998
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[CountElements] a new instance of CountElements
1005
999
 
1006
- Returns all elements that exactly match name
1000
+ --
1007
1001
 
1008
- __Parameters:__
1002
+ ##### [reset](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L131)
1009
1003
 
1010
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] name - the name to exactly match
1004
+ > def reset
1011
1005
 
1012
- __Returns:__
1013
1006
 
1014
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Element>]
1015
1007
 
1016
1008
  --
1017
1009
 
1018
- ##### [tag](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L210)
1010
+ ##### [start_element](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L136)
1019
1011
 
1020
- > def tag tag_name
1012
+ > def start_element name, attrs = []
1021
1013
 
1022
- Returns the first element matching tag_name
1014
+ http://nokogiri.org/Nokogiri/XML/SAX/Document.html
1023
1015
 
1024
- __Parameters:__
1016
+ --
1025
1017
 
1026
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] tag_name - the tag_name to search for
1018
+ ##### [formatted_result](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L140)
1019
+
1020
+ > def formatted_result
1027
1021
 
1028
- __Returns:__
1029
1022
 
1030
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
1031
1023
 
1032
1024
  --
1033
1025
 
1034
- ##### [tags](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L218)
1026
+ ##### [get_page_class](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L151)
1035
1027
 
1036
- > def tags tag_name
1028
+ > def get_page_class
1037
1029
 
1038
- Returns all elements matching tag_name
1030
+ Returns a string of class counts.
1039
1031
 
1040
- __Parameters:__
1032
+ --
1041
1033
 
1042
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] tag_name - the tag_name to search for
1034
+ ##### [page_class](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L162)
1043
1035
 
1044
- __Returns:__
1036
+ > def page_class
1045
1037
 
1046
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
1038
+ Count all classes on screen and print to stdout.
1039
+ Useful for appium_console.
1047
1040
 
1048
1041
  --
1049
1042
 
1050
- ##### [px_to_window_rel](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L228)
1043
+ ##### [px_to_window_rel](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L172)
1051
1044
 
1052
1045
  > def px_to_window_rel opts={}
1053
1046
 
@@ -1059,15 +1052,7 @@ px_to_window_rel x: 50, y: 150
1059
1052
 
1060
1053
  --
1061
1054
 
1062
- ##### [lazy_load_strings](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L238)
1063
-
1064
- > def lazy_load_strings
1065
-
1066
-
1067
-
1068
- --
1069
-
1070
- ##### [xml_keys](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L245)
1055
+ ##### [xml_keys](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L189)
1071
1056
 
1072
1057
  > def xml_keys target
1073
1058
 
@@ -1083,7 +1068,7 @@ __Returns:__
1083
1068
 
1084
1069
  --
1085
1070
 
1086
- ##### [xml_values](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L253)
1071
+ ##### [xml_values](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L197)
1087
1072
 
1088
1073
  > def xml_values target
1089
1074
 
@@ -1099,7 +1084,7 @@ __Returns:__
1099
1084
 
1100
1085
  --
1101
1086
 
1102
- ##### [resolve_id](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L261)
1087
+ ##### [resolve_id](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/helper.rb#L205)
1103
1088
 
1104
1089
  > def resolve_id id
1105
1090
 
@@ -1115,402 +1100,502 @@ __Returns:__
1115
1100
 
1116
1101
  --
1117
1102
 
1118
- ##### [raise_no_element_error](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/helper.rb#L267)
1103
+ ##### [window_size](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/element/window.rb#L5)
1119
1104
 
1120
- > def raise_no_element_error
1105
+ > def window_size
1121
1106
 
1122
- Used to error when finding a single element fails.
1107
+ Get the window's size
1123
1108
 
1124
1109
  --
1125
1110
 
1126
- ##### [value](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/patch.rb#L32)
1111
+ ##### [result](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/helper.rb#L7) android
1127
1112
 
1128
- > def value
1113
+ > def result
1129
1114
 
1130
- Returns the value attribute
1115
+ TODO: Support strings.xml ids
1131
1116
 
1132
- Fixes NoMethodError: undefined method `value' for Selenium::WebDriver::Element
1117
+ --
1118
+
1119
+ ##### [keys](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/helper.rb#L7) android
1120
+
1121
+ > def keys
1122
+
1123
+ TODO: Support strings.xml ids
1133
1124
 
1134
1125
  --
1135
1126
 
1136
- ##### [name](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/patch.rb#L39)
1127
+ ##### [filter](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/helper.rb#L9) android
1137
1128
 
1138
- > def name
1129
+ > def filter
1139
1130
 
1140
- Returns the name attribute
1141
1131
 
1142
- Fixes NoMethodError: undefined method `name' for Selenium::WebDriver::Element
1143
1132
 
1144
1133
  --
1145
1134
 
1146
- ##### [location_rel](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/common/patch.rb#L51)
1135
+ ##### [filter=](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/helper.rb#L14) android
1147
1136
 
1148
- > def location_rel
1137
+ > def filter= value
1149
1138
 
1150
- For use with mobile tap.
1139
+ convert to string to support symbols
1140
+
1141
+ --
1142
+
1143
+ ##### [initialize](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/helper.rb#L20) android
1144
+
1145
+ > def initialize
1151
1146
 
1152
- ```ruby
1153
- execute_script 'mobile: tap', :x => 0.0, :y => 0.98
1154
- ```
1155
1147
 
1156
- https://github.com/appium/appium/wiki/Automating-mobile-gestures
1157
1148
 
1158
1149
  __Returns:__
1159
1150
 
1160
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[OpenStruct] the relative x, y in a struct. ex: { x: 0.50, y: 0.20 }
1151
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[AndroidElements] a new instance of AndroidElements
1161
1152
 
1162
1153
  --
1163
1154
 
1164
- ##### [CORE](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L16)
1155
+ ##### [reset](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/helper.rb#L25) android
1165
1156
 
1166
- > CORE = [ :array, :hash, :class, :file, :dir, :bigdecimal, :rational, :struct, :openstruct, :method, :unboundmethod ]
1157
+ > def reset
1167
1158
 
1168
1159
 
1169
1160
 
1170
1161
  --
1171
1162
 
1172
- ##### [awesome_openstruct](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L18)
1173
-
1174
- > def awesome_openstruct target
1163
+ ##### [start_element](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/helper.rb#L31) android
1175
1164
 
1165
+ > def start_element name, attrs = []
1176
1166
 
1167
+ http://nokogiri.org/Nokogiri/XML/SAX/Document.html
1177
1168
 
1178
1169
  --
1179
1170
 
1180
- ##### [load_appium_txt](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L27)
1171
+ ##### [get_android_inspect](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/helper.rb#L65) android
1181
1172
 
1182
- > def load_appium_txt opts
1173
+ > def get_android_inspect class_name=false
1183
1174
 
1184
- Load appium.txt (toml format) into system ENV
1185
- the basedir of this file + appium.txt is what's used
1175
+ Android only.
1176
+ Returns a string containing interesting elements.
1177
+ The text, content description, and id are returned.
1178
+ if false (default) then all classes will be inspected
1186
1179
 
1187
1180
  __Parameters:__
1188
1181
 
1189
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Hash] opts - file: '/path/to/appium.txt', verbose: true
1182
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] class_name - the class name to filter on.
1190
1183
 
1191
1184
  __Returns:__
1192
1185
 
1193
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<String>] the require files. nil if require doesn't exist
1186
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String]
1194
1187
 
1195
1188
  --
1196
1189
 
1197
- ##### [promote_singleton_appium_methods](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L145)
1198
-
1199
- > def self.promote_singleton_appium_methods main_module
1190
+ ##### [page](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/helper.rb#L80) android
1200
1191
 
1192
+ > def page class_name=false
1201
1193
 
1194
+ Intended for use with console.
1195
+ Inspects and prints the current page.
1196
+ if false (default) then all classes will be inspected
1202
1197
 
1203
- --
1198
+ __Parameters:__
1204
1199
 
1205
- ##### [promote_appium_methods](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L175)
1200
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] class_name - the class name to filter on.
1206
1201
 
1207
- > def self.promote_appium_methods class_array
1202
+ __Returns:__
1208
1203
 
1209
- Promote appium methods to class instance methods
1204
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[void]
1210
1205
 
1211
- To promote methods to all classes:
1206
+ --
1212
1207
 
1213
- ```ruby
1214
- Appium.promote_appium_methods Object
1215
- ```
1208
+ ##### [current_app](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/helper.rb#L88) android
1216
1209
 
1217
- __Parameters:__
1210
+ > def current_app
1218
1211
 
1219
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Class>] class_array - An array of classes
1212
+ Lists package, activity, and adb shell am start -n value for current app.
1213
+ Works on local host only (not remote).
1214
+ noinspection RubyArgCount
1220
1215
 
1221
1216
  --
1222
1217
 
1223
- ##### [default_wait](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L550)
1218
+ ##### [id](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/helper.rb#L102) android
1224
1219
 
1225
- > def default_wait
1220
+ > def id id
1226
1221
 
1227
- Returns the default client side wait.
1228
- This value is independent of what the server is using
1222
+ Find by id
1223
+
1224
+ __Parameters:__
1225
+
1226
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] id - the id to search for
1229
1227
 
1230
1228
  __Returns:__
1231
1229
 
1232
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Integer]
1230
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
1233
1231
 
1234
1232
  --
1235
1233
 
1236
- ##### [app_path](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L204)
1234
+ ##### [ele_index](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/helper.rb#L116) android
1237
1235
 
1238
- > def app_path
1236
+ > def ele_index class_name, index
1239
1237
 
1240
- Returns the value of attribute app_path
1238
+ Find the element of type class_name at matching index.
1241
1239
 
1242
- --
1243
-
1244
- ##### [app_name](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L204)
1240
+ __Parameters:__
1245
1241
 
1246
- > def app_name
1242
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] class_name - the class name to find
1247
1243
 
1248
- Returns the value of attribute app_name
1244
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Integer] index - the index
1249
1245
 
1250
- --
1246
+ __Returns:__
1251
1247
 
1252
- ##### [device](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L204)
1248
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element] the found element of type class_name
1253
1249
 
1254
- > def device
1250
+ --
1255
1251
 
1256
- Returns the value of attribute device
1252
+ ##### [find_ele_by_attr](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/helper.rb#L134) android
1257
1253
 
1258
- --
1254
+ > def find_ele_by_attr class_name, attr, value
1259
1255
 
1260
- ##### [app_package](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L204)
1256
+ Find the first element exactly matching class and attribute value.
1261
1257
 
1262
- > def app_package
1258
+ __Parameters:__
1263
1259
 
1264
- Returns the value of attribute app_package
1260
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] class_name - the class name to search for
1265
1261
 
1266
- --
1262
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] attr - the attribute to inspect
1267
1263
 
1268
- ##### [app_activity](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L204)
1264
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] value - the expected value of the attribute
1269
1265
 
1270
- > def app_activity
1266
+ __Returns:__
1271
1267
 
1272
- Returns the value of attribute app_activity
1268
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
1273
1269
 
1274
1270
  --
1275
1271
 
1276
- ##### [app_wait_activity](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L204)
1272
+ ##### [find_eles_by_attr](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/helper.rb#L143) android
1277
1273
 
1278
- > def app_wait_activity
1274
+ > def find_eles_by_attr class_name, attr, value
1279
1275
 
1280
- Returns the value of attribute app_wait_activity
1276
+ Find all elements exactly matching class and attribute value.
1281
1277
 
1282
- --
1278
+ __Parameters:__
1283
1279
 
1284
- ##### [sauce_username](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L204)
1280
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] class_name - the class name to match
1285
1281
 
1286
- > def sauce_username
1282
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] attr - the attribute to compare
1287
1283
 
1288
- Returns the value of attribute sauce_username
1284
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] value - the value of the attribute that the element must have
1289
1285
 
1290
- --
1286
+ __Returns:__
1291
1287
 
1292
- ##### [sauce_access_key](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L204)
1288
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Element>]
1293
1289
 
1294
- > def sauce_access_key
1290
+ --
1295
1291
 
1296
- Returns the value of attribute sauce_access_key
1292
+ ##### [find_ele_by_attr_include](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/helper.rb#L157) android
1297
1293
 
1298
- --
1294
+ > def find_ele_by_attr_include class_name, attr, value
1299
1295
 
1300
- ##### [port](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L204)
1296
+ Find the first element by attribute that exactly matches value.
1301
1297
 
1302
- > def port
1298
+ __Parameters:__
1299
+
1300
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] class_name - the class name to match
1303
1301
 
1304
- Returns the value of attribute port
1302
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] attr - the attribute to compare
1303
+
1304
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] value - the value of the attribute that the element must include
1305
+
1306
+ __Returns:__
1307
+
1308
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element] the element of type tag who's attribute includes value
1305
1309
 
1306
1310
  --
1307
1311
 
1308
- ##### [debug](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L204)
1312
+ ##### [find_eles_by_attr_include](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/helper.rb#L166) android
1309
1313
 
1310
- > def debug
1314
+ > def find_eles_by_attr_include class_name, attr, value
1311
1315
 
1312
- Returns the value of attribute debug
1316
+ Find elements by attribute that include value.
1317
+
1318
+ __Parameters:__
1319
+
1320
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] class_name - the tag name to match
1321
+
1322
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] attr - the attribute to compare
1323
+
1324
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] value - the value of the attribute that the element must include
1325
+
1326
+ __Returns:__
1327
+
1328
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Element>] the elements of type tag who's attribute includes value
1313
1329
 
1314
1330
  --
1315
1331
 
1316
- ##### [export_session](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L204)
1332
+ ##### [first_ele](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/helper.rb#L173) android
1333
+
1334
+ > def first_ele class_name
1335
+
1336
+ Find the first element that matches class_name
1317
1337
 
1318
- > def export_session
1338
+ __Parameters:__
1339
+
1340
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] class_name - the tag to match
1319
1341
 
1320
- Returns the value of attribute export_session
1342
+ __Returns:__
1343
+
1344
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
1321
1345
 
1322
1346
  --
1323
1347
 
1324
- ##### [device_cap](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L204)
1348
+ ##### [last_ele](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/helper.rb#L181) android
1349
+
1350
+ > def last_ele class_name
1325
1351
 
1326
- > def device_cap
1352
+ Find the last element that matches class_name
1327
1353
 
1328
- Returns the value of attribute device_cap
1354
+ __Parameters:__
1355
+
1356
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] class_name - the tag to match
1357
+
1358
+ __Returns:__
1359
+
1360
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
1329
1361
 
1330
1362
  --
1331
1363
 
1332
- ##### [compress_xml](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L204)
1364
+ ##### [tag](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/helper.rb#L189) android
1365
+
1366
+ > def tag class_name
1333
1367
 
1334
- > def compress_xml
1368
+ Find the first element of type class_name
1335
1369
 
1336
- Returns the value of attribute compress_xml
1370
+ __Parameters:__
1371
+
1372
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] class_name - the class_name to search for
1373
+
1374
+ __Returns:__
1375
+
1376
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
1337
1377
 
1338
1378
  --
1339
1379
 
1340
- ##### [custom_url](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L204)
1380
+ ##### [tags](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/helper.rb#L197) android
1381
+
1382
+ > def tags class_name
1341
1383
 
1342
- > def custom_url
1384
+ Find all elements of type class_name
1343
1385
 
1344
- Returns the value of attribute custom_url
1386
+ __Parameters:__
1387
+
1388
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] class_name - the class_name to search for
1389
+
1390
+ __Returns:__
1391
+
1392
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
1345
1393
 
1346
1394
  --
1347
1395
 
1348
- ##### [global_webdriver_http_sleep](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L210)
1396
+ ##### [xpath_visible_contains](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/helper.rb#L232) android
1349
1397
 
1350
- > def global_webdriver_http_sleep
1398
+ > def xpath_visible_contains element, value
1351
1399
 
1352
- The amount to sleep in seconds before every webdriver http call.
1400
+ Find the first element that contains value
1401
+
1402
+ __Parameters:__
1403
+
1404
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] element - the class name for the element
1405
+
1406
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] value - the value to search for
1407
+
1408
+ __Returns:__
1409
+
1410
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
1353
1411
 
1354
1412
  --
1355
1413
 
1356
- ##### [global_webdriver_http_sleep=](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L210)
1414
+ ##### [xpaths_visible_contains](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/helper.rb#L240) android
1357
1415
 
1358
- > def global_webdriver_http_sleep=(value)
1416
+ > def xpaths_visible_contains element, value
1359
1417
 
1360
- The amount to sleep in seconds before every webdriver http call.
1418
+ Find all elements containing value
1419
+
1420
+ __Parameters:__
1421
+
1422
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] element - the class name for the element
1423
+
1424
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] value - the value to search for
1425
+
1426
+ __Returns:__
1427
+
1428
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Element>]
1361
1429
 
1362
1430
  --
1363
1431
 
1364
- ##### [initialize](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L240)
1432
+ ##### [xpath_visible_exact](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/helper.rb#L266) android
1365
1433
 
1366
- > def initialize opts={}
1434
+ > def xpath_visible_exact element, value
1367
1435
 
1368
- Creates a new driver.
1369
- :device is :android, :ios, or :selendroid
1436
+ Find the first element exactly matching value
1370
1437
 
1371
- ```ruby
1372
- # Options include:
1373
- :app_path, :app_name, :app_package, :app_activity,
1374
- :app_wait_activity, :sauce_username, :sauce_access_key,
1375
- :port, :os, :debug
1438
+ __Parameters:__
1376
1439
 
1377
- require 'rubygems'
1378
- require 'appium_lib'
1440
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] element - the class name for the element
1379
1441
 
1380
- # Start iOS driver
1381
- app = { device: :ios, app_path: '/path/to/MyiOS.app'}
1382
- Appium::Driver.new(app).start_driver
1442
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] value - the value to search for
1383
1443
 
1384
- # Start Android driver
1385
- apk = { device: :android
1386
- app_path: '/path/to/the.apk',
1387
- app_package: 'com.example.pkg',
1388
- app_activity: 'act.Start',
1389
- app_wait_activity: 'act.Start'
1390
- }
1444
+ __Returns:__
1391
1445
 
1392
- Appium::Driver.new(apk).start_driver
1393
- ```
1446
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
1447
+
1448
+ --
1449
+
1450
+ ##### [xpaths_visible_exact](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/helper.rb#L274) android
1451
+
1452
+ > def xpaths_visible_exact element, value
1453
+
1454
+ Find all elements exactly matching value
1394
1455
 
1395
1456
  __Parameters:__
1396
1457
 
1397
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Object] opts - A hash containing various options.
1458
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] element - the class name for the element
1459
+
1460
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] value - the value to search for
1398
1461
 
1399
1462
  __Returns:__
1400
1463
 
1401
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Driver]
1464
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
1402
1465
 
1403
1466
  --
1404
1467
 
1405
- ##### [status](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L363)
1468
+ ##### [TextView](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/text.rb#L4) android
1406
1469
 
1407
- > def status
1470
+ > TextView = 'android.widget.TextView'
1408
1471
 
1409
- Returns the status payload
1410
1472
 
1411
- ```ruby
1412
- {"status"=>0,
1413
- "value"=>
1414
- {"build"=>
1415
- {"version"=>"0.8.2",
1416
- "revision"=>"f2a2bc3782e4b0370d97a097d7e04913cf008995"}},
1417
- "sessionId"=>"8f4b34a7-a9a9-4ac5-b125-36258143446a"}
1418
- ```
1419
1473
 
1420
- Discover the Appium rev running on the server.
1474
+ --
1475
+
1476
+ ##### [s_text](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/text.rb#L10) android
1421
1477
 
1422
- `status["value"]["build"]["revision"]`
1423
- `f2a2bc3782e4b0370d97a097d7e04913cf008995`
1478
+ > def s_text value
1479
+
1480
+ Find the first TextView that contains value or by index.
1481
+ If int then the TextView at that index is returned.
1482
+
1483
+ __Parameters:__
1484
+
1485
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String, Integer] value - the value to find.
1424
1486
 
1425
1487
  __Returns:__
1426
1488
 
1427
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[JSON]
1489
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[TextView]
1428
1490
 
1429
1491
  --
1430
1492
 
1431
- ##### [server_version](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L369)
1493
+ ##### [s_texts](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/text.rb#L18) android
1494
+
1495
+ > def s_texts value
1496
+
1497
+ Find all TextViews containing value.
1432
1498
 
1433
- > def server_version
1499
+ __Parameters:__
1434
1500
 
1435
- Returns the server's version string
1501
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] value - the value to search for
1436
1502
 
1437
1503
  __Returns:__
1438
1504
 
1439
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String]
1505
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<TextView>]
1440
1506
 
1441
1507
  --
1442
1508
 
1443
- ##### [absolute_app_path](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L412)
1509
+ ##### [first_s_text](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/text.rb#L24) android
1444
1510
 
1445
- > def self.absolute_app_path app_path
1511
+ > def first_s_text
1446
1512
 
1447
- Converts environment variable APP_PATH to an absolute path.
1513
+ Find the first TextView.
1448
1514
 
1449
1515
  __Returns:__
1450
1516
 
1451
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] APP_PATH as an absolute path
1517
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[TextView]
1452
1518
 
1453
1519
  --
1454
1520
 
1455
- ##### [server_url](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L436)
1521
+ ##### [last_s_text](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/text.rb#L30) android
1456
1522
 
1457
- > def server_url
1523
+ > def last_s_text
1458
1524
 
1459
- Get the server url for sauce or local based on env vars.
1525
+ Find the last TextView.
1460
1526
 
1461
1527
  __Returns:__
1462
1528
 
1463
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] the server url
1529
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[TextView]
1464
1530
 
1465
1531
  --
1466
1532
 
1467
- ##### [restart](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L447)
1533
+ ##### [s_text_exact](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/text.rb#L37) android
1468
1534
 
1469
- > def restart
1535
+ > def s_text_exact value
1470
1536
 
1471
- Restarts the driver
1537
+ Find the first TextView that exactly matches value.
1538
+
1539
+ __Parameters:__
1540
+
1541
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] value - the value to match exactly
1472
1542
 
1473
1543
  __Returns:__
1474
1544
 
1475
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Driver] the driver
1545
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[TextView]
1476
1546
 
1477
1547
  --
1478
1548
 
1479
- ##### [driver](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L454)
1549
+ ##### [s_texts_exact](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/text.rb#L44) android
1480
1550
 
1481
- > def driver
1551
+ > def s_texts_exact value
1482
1552
 
1483
- Returns the driver
1553
+ Find all TextViews that exactly match value.
1554
+
1555
+ __Parameters:__
1556
+
1557
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] value - the value to match exactly
1484
1558
 
1485
1559
  __Returns:__
1486
1560
 
1487
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Driver] the driver
1561
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<TextView>]
1488
1562
 
1489
1563
  --
1490
1564
 
1491
- ##### [screenshot](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L464)
1565
+ ##### [e_s_texts](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/text.rb#L50) android
1492
1566
 
1493
- > def screenshot png_save_path
1567
+ > def e_s_texts
1494
1568
 
1495
- Takes a png screenshot and saves to the target path.
1569
+ Find all TextViews.
1496
1570
 
1497
- Example: screenshot '/tmp/hi.png'
1571
+ __Returns:__
1572
+
1573
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<TextView>]
1574
+
1575
+ --
1576
+
1577
+ ##### [alert_click](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/alert.rb#L6) android
1578
+
1579
+ > def alert_click value
1580
+
1581
+ Click the first alert button that contains value or by index.
1498
1582
 
1499
1583
  __Parameters:__
1500
1584
 
1501
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] png_save_path - the full path to save the png
1585
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Integer, String] value - either an integer index of the button or the button's name
1502
1586
 
1503
1587
  __Returns:__
1504
1588
 
1505
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[nil]
1589
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[void]
1506
1590
 
1507
1591
  --
1508
1592
 
1509
- ##### [driver_quit](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L471)
1593
+ ##### [alert_accept](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/alert.rb#L13) android
1510
1594
 
1511
- > def driver_quit
1595
+ > def alert_accept
1512
1596
 
1513
- Quits the driver
1597
+ Accept the alert.
1598
+ The last button is considered "accept."
1514
1599
 
1515
1600
  __Returns:__
1516
1601
 
@@ -1518,163 +1603,414 @@ __Returns:__
1518
1603
 
1519
1604
  --
1520
1605
 
1521
- ##### [start_driver](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L479)
1606
+ ##### [alert_accept_text](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/alert.rb#L20) android
1522
1607
 
1523
- > def start_driver
1608
+ > def alert_accept_text
1524
1609
 
1525
- Creates a new global driver and quits the old one if it exists.
1610
+ Get the text of the alert's accept button.
1611
+ The last button is considered "accept."
1526
1612
 
1527
1613
  __Returns:__
1528
1614
 
1529
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Selenium::WebDriver] the new global driver
1615
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String]
1530
1616
 
1531
1617
  --
1532
1618
 
1533
- ##### [no_wait](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L513)
1619
+ ##### [alert_dismiss](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/alert.rb#L27) android
1534
1620
 
1535
- > def no_wait
1621
+ > def alert_dismiss
1536
1622
 
1537
- Set implicit wait and default_wait to zero.
1623
+ Dismiss the alert.
1624
+ The first button is considered "dismiss."
1625
+
1626
+ __Returns:__
1627
+
1628
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[void]
1538
1629
 
1539
1630
  --
1540
1631
 
1541
- ##### [set_wait](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L532)
1632
+ ##### [alert_dismiss_text](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/alert.rb#L34) android
1542
1633
 
1543
- > def set_wait timeout=nil
1634
+ > def alert_dismiss_text
1544
1635
 
1545
- Set implicit wait and default_wait to timeout, defaults to 30.
1546
- if set_wait is called without a param then the second to last
1547
- wait will be used.
1636
+ Get the text of the alert's dismiss button.
1637
+ The first button is considered "dismiss."
1548
1638
 
1549
- ```ruby`
1550
- set_wait 2
1551
- set_wait 3
1552
- set_wait # 2
1639
+ __Returns:__
1553
1640
 
1554
- ````
1641
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String]
1642
+
1643
+ --
1644
+
1645
+ ##### [uiautomator_find](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/mobile_methods.rb#L10) android
1646
+
1647
+ > def uiautomator_find
1648
+
1649
+ find_element/s can be used with a [UISelector](http://developer.android.com/tools/help/uiautomator/UiSelector.html).
1650
+
1651
+ ```ruby
1652
+ find_elements :uiautomator, 'new UiSelector().clickable(true)'
1653
+ ```
1654
+
1655
+ --
1656
+
1657
+ ##### [Button](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/button.rb#L4) android
1658
+
1659
+ > Button = 'android.widget.Button'
1660
+
1661
+
1662
+
1663
+ --
1664
+
1665
+ ##### [ImageButton](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/button.rb#L5) android
1666
+
1667
+ > ImageButton = 'android.widget.ImageButton'
1668
+
1669
+
1670
+
1671
+ --
1672
+
1673
+ ##### [button](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/button.rb#L39) android
1674
+
1675
+ > def button value
1676
+
1677
+ Find the first button that contains value or by index.
1678
+ If int then the button at that index is returned.
1555
1679
 
1556
1680
  __Parameters:__
1557
1681
 
1558
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Integer] timeout - the timeout in seconds
1682
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String, Integer] value - the value to exactly match.
1559
1683
 
1560
1684
  __Returns:__
1561
1685
 
1562
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[void]
1686
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Button]
1563
1687
 
1564
1688
  --
1565
1689
 
1566
- ##### [exists](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L566)
1690
+ ##### [buttons](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/button.rb#L55) android
1567
1691
 
1568
- > def exists pre_check=0, post_check=@default_wait, &search_block
1692
+ > def buttons value
1569
1693
 
1570
- Returns existence of element.
1694
+ Find all buttons containing value
1571
1695
 
1572
- Example:
1696
+ __Parameters:__
1573
1697
 
1574
- exists { button('sign in') } ? puts('true') : puts('false')
1698
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] value - the value to search for
1699
+
1700
+ __Returns:__
1701
+
1702
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Button>]
1703
+
1704
+ --
1705
+
1706
+ ##### [first_button](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/button.rb#L61) android
1707
+
1708
+ > def first_button
1709
+
1710
+ Find the first button.
1711
+
1712
+ __Returns:__
1713
+
1714
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Button]
1715
+
1716
+ --
1717
+
1718
+ ##### [last_button](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/button.rb#L67) android
1719
+
1720
+ > def last_button
1721
+
1722
+ Find the last button.
1723
+
1724
+ __Returns:__
1725
+
1726
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Button]
1727
+
1728
+ --
1729
+
1730
+ ##### [button_exact](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/button.rb#L74) android
1731
+
1732
+ > def button_exact value
1733
+
1734
+ Find the first button that exactly matches value.
1575
1735
 
1576
1736
  __Parameters:__
1577
1737
 
1578
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Integer] pre_check - the amount in seconds to set the
1579
- wait to before checking existance
1738
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] value - the value to match exactly
1580
1739
 
1581
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Integer] post_check - the amount in seconds to set the
1582
- wait to after checking existance
1740
+ __Returns:__
1583
1741
 
1584
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Block] search_block - the block to call
1742
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Button]
1743
+
1744
+ --
1745
+
1746
+ ##### [buttons_exact](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/button.rb#L81) android
1747
+
1748
+ > def buttons_exact value
1749
+
1750
+ Find all buttons that exactly match value.
1751
+
1752
+ __Parameters:__
1753
+
1754
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] value - the value to match exactly
1585
1755
 
1586
1756
  __Returns:__
1587
1757
 
1588
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Boolean]
1758
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Button>]
1589
1759
 
1590
1760
  --
1591
1761
 
1592
- ##### [execute_script](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L590)
1762
+ ##### [e_buttons](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/button.rb#L87) android
1593
1763
 
1594
- > def execute_script script, *args
1764
+ > def e_buttons
1595
1765
 
1596
- The same as @driver.execute_script
1766
+ Find all buttons.
1767
+
1768
+ __Returns:__
1769
+
1770
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Button>]
1771
+
1772
+ --
1773
+
1774
+ ##### [find](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/generic.rb#L7) android
1775
+
1776
+ > def find value
1777
+
1778
+ Find the first element containing value
1597
1779
 
1598
1780
  __Parameters:__
1599
1781
 
1600
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] script - the script to execute
1782
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] value - the value to search for
1601
1783
 
1602
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[*args] args - the args to pass to the script
1784
+ __Returns:__
1785
+
1786
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
1787
+
1788
+ --
1789
+
1790
+ ##### [finds](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/generic.rb#L14) android
1791
+
1792
+ > def finds value
1793
+
1794
+ Find all elements containing value
1795
+
1796
+ __Parameters:__
1797
+
1798
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] value - the value to search for
1603
1799
 
1604
1800
  __Returns:__
1605
1801
 
1606
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Object]
1802
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Element>]
1607
1803
 
1608
1804
  --
1609
1805
 
1610
- ##### [mobile](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L606)
1806
+ ##### [find_exact](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/generic.rb#L21) android
1611
1807
 
1612
- > def mobile method, *args
1808
+ > def find_exact value
1613
1809
 
1614
- Helper method for mobile gestures
1810
+ Find the first element exactly matching value
1615
1811
 
1616
- https://github.com/appium/appium/wiki/Automating-mobile-gestures
1812
+ __Parameters:__
1617
1813
 
1618
- driver.execute_script 'mobile: swipe', endX: 100, endY: 100, duration: 0.01
1814
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] value - the value to search for
1619
1815
 
1620
- becomes
1816
+ __Returns:__
1621
1817
 
1622
- mobile :swipe, endX: 100, endY: 100, duration: 0.01
1818
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
1819
+
1820
+ --
1821
+
1822
+ ##### [finds_exact](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/generic.rb#L28) android
1823
+
1824
+ > def finds_exact value
1825
+
1826
+ Find all elements exactly matching value
1623
1827
 
1624
1828
  __Parameters:__
1625
1829
 
1626
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String, Symbol] method - the method to execute
1830
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] value - the value to search for
1831
+
1832
+ __Returns:__
1627
1833
 
1628
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[*args] args - the args to pass to the method
1834
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Element>]
1835
+
1836
+ --
1837
+
1838
+ ##### [scroll_to](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/generic.rb#L35) android
1839
+
1840
+ > def scroll_to text
1841
+
1842
+ Scroll to the first element containing target text or description.
1843
+
1844
+ __Parameters:__
1845
+
1846
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text to search for in the text value and content description
1629
1847
 
1630
1848
  __Returns:__
1631
1849
 
1632
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Object]
1850
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element] the element scrolled to
1633
1851
 
1634
1852
  --
1635
1853
 
1636
- ##### [find_elements](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L617)
1854
+ ##### [scroll_to_exact](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/generic.rb#L48) android
1637
1855
 
1638
- > def find_elements *args
1856
+ > def scroll_to_exact text
1639
1857
 
1640
- Calls @driver.find_elements
1858
+ Scroll to the first element with the exact target text or description.
1641
1859
 
1642
1860
  __Parameters:__
1643
1861
 
1644
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[*args] args - the args to use
1862
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] text - the text to search for in the text value and content description
1645
1863
 
1646
1864
  __Returns:__
1647
1865
 
1648
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<Element>] Array is empty when no elements are found.
1866
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element] the element scrolled to
1649
1867
 
1650
1868
  --
1651
1869
 
1652
- ##### [find_element](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L625)
1870
+ ##### [EditText](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/textfield.rb#L3) android
1653
1871
 
1654
- > def find_element *args
1872
+ > EditText = 'android.widget.EditText'
1655
1873
 
1656
- Calls @driver.find_elements
1874
+
1875
+
1876
+ --
1877
+
1878
+ ##### [textfield](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/textfield.rb#L9) android
1879
+
1880
+ > def textfield value
1881
+
1882
+ Find the first EditText that contains value or by index.
1883
+ If int then the EditText at that index is returned.
1657
1884
 
1658
1885
  __Parameters:__
1659
1886
 
1660
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[*args] args - the args to use
1887
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String, Integer] value - the text to match exactly.
1661
1888
 
1662
1889
  __Returns:__
1663
1890
 
1664
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Element]
1891
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[EditText]
1665
1892
 
1666
1893
  --
1667
1894
 
1668
- ##### [x](https://github.com/appium/ruby_lib/blob/a07da28de1e7133c77070859c2c35d7bd2635684/lib/appium_lib/driver.rb#L632)
1895
+ ##### [textfields](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/textfield.rb#L17) android
1669
1896
 
1670
- > def x
1897
+ > def textfields value
1671
1898
 
1672
- Quit the driver and Pry.
1673
- quit and exit are reserved by Pry.
1899
+ Find all EditTexts containing value.
1900
+
1901
+ __Parameters:__
1902
+
1903
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] value - the value to search for
1674
1904
 
1675
1905
  __Returns:__
1676
1906
 
1677
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[void]
1907
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<EditText>]
1908
+
1909
+ --
1910
+
1911
+ ##### [first_textfield](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/textfield.rb#L23) android
1912
+
1913
+ > def first_textfield
1914
+
1915
+ Find the first EditText.
1916
+
1917
+ __Returns:__
1918
+
1919
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[EditText]
1920
+
1921
+ --
1922
+
1923
+ ##### [last_textfield](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/textfield.rb#L29) android
1924
+
1925
+ > def last_textfield
1926
+
1927
+ Find the last EditText.
1928
+
1929
+ __Returns:__
1930
+
1931
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[EditText]
1932
+
1933
+ --
1934
+
1935
+ ##### [textfield_exact](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/textfield.rb#L36) android
1936
+
1937
+ > def textfield_exact value
1938
+
1939
+ Find the first EditText that exactly matches value.
1940
+
1941
+ __Parameters:__
1942
+
1943
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] value - the value to match exactly
1944
+
1945
+ __Returns:__
1946
+
1947
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[EditText]
1948
+
1949
+ --
1950
+
1951
+ ##### [textfields_exact](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/textfield.rb#L43) android
1952
+
1953
+ > def textfields_exact value
1954
+
1955
+ Find all EditTexts that exactly match value.
1956
+
1957
+ __Parameters:__
1958
+
1959
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[String] value - the value to match exactly
1960
+
1961
+ __Returns:__
1962
+
1963
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<EditText>]
1964
+
1965
+ --
1966
+
1967
+ ##### [e_textfields](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/android/element/textfield.rb#L49) android
1968
+
1969
+ > def e_textfields
1970
+
1971
+ Find all EditTexts.
1972
+
1973
+ __Returns:__
1974
+
1975
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Array<EditText>]
1976
+
1977
+ --
1978
+
1979
+ ##### [value](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/patch.rb#L10)
1980
+
1981
+ > def value
1982
+
1983
+ Returns the value attribute
1984
+
1985
+ Fixes NoMethodError: undefined method `value' for Selenium::WebDriver::Element
1986
+
1987
+ --
1988
+
1989
+ ##### [name](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/patch.rb#L17)
1990
+
1991
+ > def name
1992
+
1993
+ Returns the name attribute
1994
+
1995
+ Fixes NoMethodError: undefined method `name' for Selenium::WebDriver::Element
1996
+
1997
+ --
1998
+
1999
+ ##### [location_rel](https://github.com/appium/ruby_lib/blob/5a3ecbb4147693ce3c2c6b693e64074022d03511/lib/appium_lib/common/patch.rb#L29)
2000
+
2001
+ > def location_rel
2002
+
2003
+ For use with mobile tap.
2004
+
2005
+ ```ruby
2006
+ execute_script 'mobile: tap', :x => 0.0, :y => 0.98
2007
+ ```
2008
+
2009
+ https://github.com/appium/appium/wiki/Automating-mobile-gestures
2010
+
2011
+ __Returns:__
2012
+
2013
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[OpenStruct] the relative x, y in a struct. ex: { x: 0.50, y: 0.20 }
1678
2014
 
1679
2015
  --
1680
2016