appium_lib 10.2.0 → 10.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -14
  3. data/.travis.yml +0 -2
  4. data/CHANGELOG.md +9 -0
  5. data/Gemfile +14 -0
  6. data/Rakefile +14 -0
  7. data/appium_lib.gemspec +2 -2
  8. data/docs/android_docs.md +261 -229
  9. data/docs/ios_docs.md +346 -282
  10. data/lib/appium_lib.rb +14 -0
  11. data/lib/appium_lib/android/android.rb +14 -0
  12. data/lib/appium_lib/android/common/command/command.rb +14 -0
  13. data/lib/appium_lib/android/common/helper.rb +14 -0
  14. data/lib/appium_lib/android/element/alert.rb +14 -0
  15. data/lib/appium_lib/android/element/button.rb +35 -18
  16. data/lib/appium_lib/android/element/generic.rb +14 -0
  17. data/lib/appium_lib/android/element/text.rb +29 -14
  18. data/lib/appium_lib/android/element/textfield.rb +30 -15
  19. data/lib/appium_lib/android/espresso.rb +14 -0
  20. data/lib/appium_lib/android/espresso/bridge.rb +14 -0
  21. data/lib/appium_lib/android/espresso/element.rb +14 -0
  22. data/lib/appium_lib/android/espresso/element/button.rb +26 -12
  23. data/lib/appium_lib/android/espresso/element/generic.rb +14 -0
  24. data/lib/appium_lib/android/espresso/helper.rb +14 -0
  25. data/lib/appium_lib/android/uiautomator2.rb +14 -0
  26. data/lib/appium_lib/android/uiautomator2/bridge.rb +14 -0
  27. data/lib/appium_lib/android/uiautomator2/element.rb +14 -0
  28. data/lib/appium_lib/android/uiautomator2/element/button.rb +14 -0
  29. data/lib/appium_lib/android/uiautomator2/helper.rb +14 -0
  30. data/lib/appium_lib/appium.rb +14 -0
  31. data/lib/appium_lib/common/command.rb +14 -0
  32. data/lib/appium_lib/common/command/ws_logcat.rb +14 -0
  33. data/lib/appium_lib/common/device.rb +14 -0
  34. data/lib/appium_lib/common/helper.rb +19 -5
  35. data/lib/appium_lib/common/http_client.rb +14 -0
  36. data/lib/appium_lib/common/log.rb +14 -0
  37. data/lib/appium_lib/common/multi_touch.rb +14 -0
  38. data/lib/appium_lib/common/touch_actions.rb +14 -0
  39. data/lib/appium_lib/common/wait.rb +14 -0
  40. data/lib/appium_lib/driver.rb +16 -2
  41. data/lib/appium_lib/ios/common/errors.rb +14 -0
  42. data/lib/appium_lib/ios/common/helper.rb +15 -1
  43. data/lib/appium_lib/ios/element/alert.rb +14 -0
  44. data/lib/appium_lib/ios/element/button.rb +26 -9
  45. data/lib/appium_lib/ios/element/generic.rb +14 -0
  46. data/lib/appium_lib/ios/element/text.rb +26 -9
  47. data/lib/appium_lib/ios/element/textfield.rb +25 -7
  48. data/lib/appium_lib/ios/ios.rb +14 -0
  49. data/lib/appium_lib/ios/xcuitest.rb +14 -0
  50. data/lib/appium_lib/ios/xcuitest/bridge.rb +14 -0
  51. data/lib/appium_lib/ios/xcuitest/command.rb +14 -0
  52. data/lib/appium_lib/ios/xcuitest/command/certificate.rb +14 -0
  53. data/lib/appium_lib/ios/xcuitest/command/gestures.rb +14 -0
  54. data/lib/appium_lib/ios/xcuitest/command/get_context.rb +14 -0
  55. data/lib/appium_lib/ios/xcuitest/command/multi_app_handler.rb +14 -0
  56. data/lib/appium_lib/ios/xcuitest/command/pasteboard.rb +14 -0
  57. data/lib/appium_lib/ios/xcuitest/command/source.rb +14 -0
  58. data/lib/appium_lib/ios/xcuitest/element.rb +14 -0
  59. data/lib/appium_lib/ios/xcuitest/element/button.rb +22 -8
  60. data/lib/appium_lib/ios/xcuitest/element/generic.rb +14 -0
  61. data/lib/appium_lib/ios/xcuitest/element/text.rb +22 -8
  62. data/lib/appium_lib/ios/xcuitest/element/textfield.rb +18 -4
  63. data/lib/appium_lib/ios/xcuitest/helper.rb +14 -0
  64. data/lib/appium_lib/sauce_labs.rb +14 -0
  65. data/lib/appium_lib/version.rb +16 -2
  66. data/release_notes.md +7 -0
  67. metadata +4 -4
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  # Enforce UTF-8 Encoding
2
16
  Encoding.default_external = Encoding::UTF_8
3
17
  Encoding.default_internal = Encoding::UTF_8
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  require_relative 'common/helper'
2
16
  require_relative 'common/command/command'
3
17
 
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  module Appium
2
16
  module Android
3
17
  module Command
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  module Appium
2
16
  module Android
3
17
  # @private
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  module Appium
2
16
  module Android
3
17
  # Click the first alert button that contains value or by index.
@@ -1,12 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  module Appium
2
16
  module Android
3
- Button = 'android.widget.Button'.freeze
4
- ImageButton = 'android.widget.ImageButton'.freeze
17
+ BUTTON = 'android.widget.Button'
18
+ Button = BUTTON # backward compatibility
19
+
20
+ IMAGE_BUTTON = 'android.widget.ImageButton'
21
+ ImageButton = IMAGE_BUTTON # backward compatibility
5
22
 
6
23
  # Find the first button that contains value or by index.
7
24
  # @param value [String, Integer] the value to exactly match.
8
25
  # If int then the button at that index is returned.
9
- # @return [Button]
26
+ # @return [BUTTON]
10
27
  def button(value)
11
28
  # Don't use ele_index because that only works on one element type.
12
29
  # Android needs to combine button and image button to match iOS.
@@ -24,7 +41,7 @@ module Appium
24
41
  # Find all buttons containing value.
25
42
  # If value is omitted, all buttons are returned.
26
43
  # @param value [String] the value to search for
27
- # @return [Array<Button>]
44
+ # @return [Array<BUTTON>]
28
45
  def buttons(value = false)
29
46
  return find_elements :uiautomator, _button_visible_selectors unless value
30
47
 
@@ -32,19 +49,19 @@ module Appium
32
49
  end
33
50
 
34
51
  # Find the first button.
35
- # @return [Button]
52
+ # @return [BUTTON]
36
53
  def first_button
37
54
  find_element :uiautomator, _button_visible_selectors(button_index: 0, image_button_index: 0)
38
55
  end
39
56
 
40
57
  # Find the last button.
41
- # @return [Button]
58
+ # @return [BUTTON]
42
59
  def last_button
43
60
  # uiautomator index doesn't support last
44
61
  # and it's 0 indexed
45
- button_index = tags(Button).length
62
+ button_index = tags(BUTTON).length
46
63
  button_index -= 1 if button_index > 0
47
- image_button_index = tags(ImageButton).length
64
+ image_button_index = tags(IMAGE_BUTTON).length
48
65
  image_button_index -= 1 if image_button_index > 0
49
66
 
50
67
  find_element :uiautomator,
@@ -54,14 +71,14 @@ module Appium
54
71
 
55
72
  # Find the first button that exactly matches value.
56
73
  # @param value [String] the value to match exactly
57
- # @return [Button]
74
+ # @return [BUTTON]
58
75
  def button_exact(value)
59
76
  find_element :uiautomator, _button_exact_string(value)
60
77
  end
61
78
 
62
79
  # Find all buttons that exactly match value.
63
80
  # @param value [String] the value to match exactly
64
- # @return [Array<Button>]
81
+ # @return [Array<BUTTON>]
65
82
  def buttons_exact(value)
66
83
  find_elements :uiautomator, _button_exact_string(value)
67
84
  end
@@ -80,23 +97,23 @@ module Appium
80
97
  image_button_index = opts.fetch :image_button_index, false
81
98
 
82
99
  if button_index && image_button_index
83
- "new UiSelector().className(#{Button}).instance(#{button_index});" \
84
- "new UiSelector().className(#{ImageButton}).instance(#{image_button_index});"
100
+ "new UiSelector().className(#{BUTTON}).instance(#{button_index});" \
101
+ "new UiSelector().className(#{IMAGE_BUTTON}).instance(#{image_button_index});"
85
102
  else
86
- "new UiSelector().className(#{Button});" \
87
- "new UiSelector().className(#{ImageButton});"
103
+ "new UiSelector().className(#{BUTTON});" \
104
+ "new UiSelector().className(#{IMAGE_BUTTON});"
88
105
  end
89
106
  end
90
107
 
91
108
  def _button_exact_string(value)
92
- button = string_visible_exact Button, value
93
- image_button = string_visible_exact ImageButton, value
109
+ button = string_visible_exact BUTTON, value
110
+ image_button = string_visible_exact IMAGE_BUTTON, value
94
111
  button + image_button
95
112
  end
96
113
 
97
114
  def _button_contains_string(value)
98
- button = string_visible_contains Button, value
99
- image_button = string_visible_contains ImageButton, value
115
+ button = string_visible_contains BUTTON, value
116
+ image_button = string_visible_contains IMAGE_BUTTON, value
100
117
  button + image_button
101
118
  end
102
119
  end # module Android
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  module Appium
2
16
  module Android
3
17
  # Find the first element containing value
@@ -1,52 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  # TextView methods
2
16
  module Appium
3
17
  module Android
4
- TextView = 'android.widget.TextView'.freeze
18
+ TEXT_VIEW = 'android.widget.TextView'
19
+ TextView = TEXT_VIEW
5
20
 
6
21
  # Find the first TextView that contains value or by index.
7
22
  # @param value [String, Integer] the value to find.
8
23
  # If int then the TextView at that index is returned.
9
24
  # @return [TextView]
10
25
  def text(value)
11
- return ele_index TextView, value if value.is_a? Numeric
26
+ return ele_index TEXT_VIEW, value if value.is_a? Numeric
12
27
 
13
- complex_find_contains TextView, value
28
+ complex_find_contains TEXT_VIEW, value
14
29
  end
15
30
 
16
31
  # Find all TextViews containing value.
17
32
  # If value is omitted, all texts are returned.
18
33
  # @param value [String] the value to search for
19
- # @return [Array<TextView>]
34
+ # @return [Array<TEXT_VIEW>]
20
35
  def texts(value = false)
21
- return tags TextView unless value
36
+ return tags TEXT_VIEW unless value
22
37
 
23
- complex_finds_contains TextView, value
38
+ complex_finds_contains TEXT_VIEW, value
24
39
  end
25
40
 
26
41
  # Find the first TextView.
27
- # @return [TextView]
42
+ # @return [TEXT_VIEW]
28
43
  def first_text
29
- first_ele TextView
44
+ first_ele TEXT_VIEW
30
45
  end
31
46
 
32
47
  # Find the last TextView.
33
- # @return [TextView]
48
+ # @return [TEXT_VIEW]
34
49
  def last_text
35
- last_ele TextView
50
+ last_ele TEXT_VIEW
36
51
  end
37
52
 
38
53
  # Find the first TextView that exactly matches value.
39
54
  # @param value [String] the value to match exactly
40
- # @return [TextView]
55
+ # @return [TEXT_VIEW]
41
56
  def text_exact(value)
42
- complex_find_exact TextView, value
57
+ complex_find_exact TEXT_VIEW, value
43
58
  end
44
59
 
45
60
  # Find all TextViews that exactly match value.
46
61
  # @param value [String] the value to match exactly
47
- # @return [Array<TextView>]
62
+ # @return [Array<TEXT_VIEW>]
48
63
  def texts_exact(value)
49
- complex_finds_exact TextView, value
64
+ complex_finds_exact TEXT_VIEW, value
50
65
  end
51
66
  end # module Android
52
67
  end # module Appium
@@ -1,51 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  module Appium
2
16
  module Android
3
- EditText = 'android.widget.EditText'.freeze
17
+ EDIT_TEXT = 'android.widget.EditText'
18
+ EditText = EDIT_TEXT
4
19
 
5
20
  # Find the first EditText that contains value or by index.
6
21
  # @param value [String, Integer] the text to match exactly.
7
22
  # If int then the EditText at that index is returned.
8
- # @return [EditText]
23
+ # @return [EDIT_TEXT]
9
24
  def textfield(value)
10
- return ele_index EditText, value if value.is_a? Numeric
25
+ return ele_index EDIT_TEXT, value if value.is_a? Numeric
11
26
 
12
- complex_find_contains EditText, value
27
+ complex_find_contains EDIT_TEXT, value
13
28
  end
14
29
 
15
30
  # Find all EditTexts containing value.
16
31
  # If value is omitted, all EditTexts are returned.
17
32
  # @param value [String] the value to search for
18
- # @return [Array<EditText>]
33
+ # @return [Array<EDIT_TEXT>]
19
34
  def textfields(value = false)
20
- return tags EditText unless value
35
+ return tags EDIT_TEXT unless value
21
36
 
22
- complex_finds_contains EditText, value
37
+ complex_finds_contains EDIT_TEXT, value
23
38
  end
24
39
 
25
40
  # Find the first EditText.
26
- # @return [EditText]
41
+ # @return [EDIT_TEXT]
27
42
  def first_textfield
28
- first_ele EditText
43
+ first_ele EDIT_TEXT
29
44
  end
30
45
 
31
46
  # Find the last EditText.
32
- # @return [EditText]
47
+ # @return [EDIT_TEXT]
33
48
  def last_textfield
34
- last_ele EditText
49
+ last_ele EDIT_TEXT
35
50
  end
36
51
 
37
52
  # Find the first EditText that exactly matches value.
38
53
  # @param value [String] the value to match exactly
39
- # @return [EditText]
54
+ # @return [EDIT_TEXT]
40
55
  def textfield_exact(value)
41
- complex_find_exact EditText, value
56
+ complex_find_exact EDIT_TEXT, value
42
57
  end
43
58
 
44
59
  # Find all EditTexts that exactly match value.
45
60
  # @param value [String] the value to match exactly
46
- # @return [Array<EditText>]
61
+ # @return [Array<EDIT_TEXT>]
47
62
  def textfields_exact(value)
48
- complex_finds_exact EditText, value
63
+ complex_finds_exact EDIT_TEXT, value
49
64
  end
50
65
  end # module Android
51
66
  end # module Appium
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  require_relative 'espresso/helper'
2
16
  require_relative 'espresso/element'
3
17
  require_relative 'espresso/bridge'
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  require_relative '../android'
2
16
 
3
17
  module Appium
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  require_relative 'element/generic'
2
16
  require_relative 'element/button'
3
17
 
@@ -1,3 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  module Appium
2
16
  module Android
3
17
  module Espresso
@@ -17,8 +31,8 @@ module Appium
17
31
  _button_visible_selectors_xpath(index: index - 1)
18
32
  end
19
33
 
20
- i = find_elements :xpath, _button_contains_string_xpath(Button, value)
21
- e = find_elements :xpath, _button_contains_string_xpath(ImageButton, value)
34
+ i = find_elements :xpath, _button_contains_string_xpath(BUTTON, value)
35
+ e = find_elements :xpath, _button_contains_string_xpath(IMAGE_BUTTON, value)
22
36
 
23
37
  raise_no_such_element_if_empty(i + e)
24
38
 
@@ -32,8 +46,8 @@ module Appium
32
46
  def buttons(value = false)
33
47
  return _button_visible_selectors_xpath unless value
34
48
 
35
- i = find_elements :xpath, _button_contains_string_xpath(Button, value)
36
- e = find_elements :xpath, _button_contains_string_xpath(ImageButton, value)
49
+ i = find_elements :xpath, _button_contains_string_xpath(BUTTON, value)
50
+ e = find_elements :xpath, _button_contains_string_xpath(IMAGE_BUTTON, value)
37
51
  i + e
38
52
  end
39
53
 
@@ -48,9 +62,9 @@ module Appium
48
62
  def last_button
49
63
  # uiautomator index doesn't support last
50
64
  # and it's 0 indexed
51
- button_index = tags(::Appium::Android::Button).length
65
+ button_index = tags(::Appium::Android::BUTTON).length
52
66
  button_index -= 1 if button_index > 0
53
- image_button_index = tags(::Appium::Android::ImageButton).length
67
+ image_button_index = tags(::Appium::Android::IMAGE_BUTTON).length
54
68
  image_button_index -= 1 if image_button_index > 0
55
69
 
56
70
  _button_visible_selectors_xpath(button_index: button_index,
@@ -61,8 +75,8 @@ module Appium
61
75
  # @param value [String] the value to match exactly
62
76
  # @return [Button]
63
77
  def button_exact(value)
64
- i = find_elements :xpath, _button_exact_string_xpath(Button, value)
65
- e = find_elements :xpath, _button_exact_string_xpath(ImageButton, value)
78
+ i = find_elements :xpath, _button_exact_string_xpath(BUTTON, value)
79
+ e = find_elements :xpath, _button_exact_string_xpath(IMAGE_BUTTON, value)
66
80
 
67
81
  raise_no_such_element_if_empty(i + e)
68
82
 
@@ -73,8 +87,8 @@ module Appium
73
87
  # @param value [String] the value to match exactly
74
88
  # @return [Array<Button>]
75
89
  def buttons_exact(value)
76
- i = find_elements :xpath, _button_exact_string_xpath(Button, value)
77
- e = find_elements :xpath, _button_exact_string_xpath(ImageButton, value)
90
+ i = find_elements :xpath, _button_exact_string_xpath(BUTTON, value)
91
+ e = find_elements :xpath, _button_exact_string_xpath(IMAGE_BUTTON, value)
78
92
  i + e
79
93
  end
80
94
 
@@ -93,8 +107,8 @@ module Appium
93
107
 
94
108
  index = opts.fetch :index, false
95
109
 
96
- b = find_elements :xpath, "//#{Button}"
97
- i = find_elements :xpath, "//#{ImageButton}"
110
+ b = find_elements :xpath, "//#{BUTTON}"
111
+ i = find_elements :xpath, "//#{IMAGE_BUTTON}"
98
112
 
99
113
  if index
100
114
  raise_no_such_element_if_empty(b + i)