appium_lib 10.2.0 → 10.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -14
- data/.travis.yml +0 -2
- data/CHANGELOG.md +9 -0
- data/Gemfile +14 -0
- data/Rakefile +14 -0
- data/appium_lib.gemspec +2 -2
- data/docs/android_docs.md +261 -229
- data/docs/ios_docs.md +346 -282
- data/lib/appium_lib.rb +14 -0
- data/lib/appium_lib/android/android.rb +14 -0
- data/lib/appium_lib/android/common/command/command.rb +14 -0
- data/lib/appium_lib/android/common/helper.rb +14 -0
- data/lib/appium_lib/android/element/alert.rb +14 -0
- data/lib/appium_lib/android/element/button.rb +35 -18
- data/lib/appium_lib/android/element/generic.rb +14 -0
- data/lib/appium_lib/android/element/text.rb +29 -14
- data/lib/appium_lib/android/element/textfield.rb +30 -15
- data/lib/appium_lib/android/espresso.rb +14 -0
- data/lib/appium_lib/android/espresso/bridge.rb +14 -0
- data/lib/appium_lib/android/espresso/element.rb +14 -0
- data/lib/appium_lib/android/espresso/element/button.rb +26 -12
- data/lib/appium_lib/android/espresso/element/generic.rb +14 -0
- data/lib/appium_lib/android/espresso/helper.rb +14 -0
- data/lib/appium_lib/android/uiautomator2.rb +14 -0
- data/lib/appium_lib/android/uiautomator2/bridge.rb +14 -0
- data/lib/appium_lib/android/uiautomator2/element.rb +14 -0
- data/lib/appium_lib/android/uiautomator2/element/button.rb +14 -0
- data/lib/appium_lib/android/uiautomator2/helper.rb +14 -0
- data/lib/appium_lib/appium.rb +14 -0
- data/lib/appium_lib/common/command.rb +14 -0
- data/lib/appium_lib/common/command/ws_logcat.rb +14 -0
- data/lib/appium_lib/common/device.rb +14 -0
- data/lib/appium_lib/common/helper.rb +19 -5
- data/lib/appium_lib/common/http_client.rb +14 -0
- data/lib/appium_lib/common/log.rb +14 -0
- data/lib/appium_lib/common/multi_touch.rb +14 -0
- data/lib/appium_lib/common/touch_actions.rb +14 -0
- data/lib/appium_lib/common/wait.rb +14 -0
- data/lib/appium_lib/driver.rb +16 -2
- data/lib/appium_lib/ios/common/errors.rb +14 -0
- data/lib/appium_lib/ios/common/helper.rb +15 -1
- data/lib/appium_lib/ios/element/alert.rb +14 -0
- data/lib/appium_lib/ios/element/button.rb +26 -9
- data/lib/appium_lib/ios/element/generic.rb +14 -0
- data/lib/appium_lib/ios/element/text.rb +26 -9
- data/lib/appium_lib/ios/element/textfield.rb +25 -7
- data/lib/appium_lib/ios/ios.rb +14 -0
- data/lib/appium_lib/ios/xcuitest.rb +14 -0
- data/lib/appium_lib/ios/xcuitest/bridge.rb +14 -0
- data/lib/appium_lib/ios/xcuitest/command.rb +14 -0
- data/lib/appium_lib/ios/xcuitest/command/certificate.rb +14 -0
- data/lib/appium_lib/ios/xcuitest/command/gestures.rb +14 -0
- data/lib/appium_lib/ios/xcuitest/command/get_context.rb +14 -0
- data/lib/appium_lib/ios/xcuitest/command/multi_app_handler.rb +14 -0
- data/lib/appium_lib/ios/xcuitest/command/pasteboard.rb +14 -0
- data/lib/appium_lib/ios/xcuitest/command/source.rb +14 -0
- data/lib/appium_lib/ios/xcuitest/element.rb +14 -0
- data/lib/appium_lib/ios/xcuitest/element/button.rb +22 -8
- data/lib/appium_lib/ios/xcuitest/element/generic.rb +14 -0
- data/lib/appium_lib/ios/xcuitest/element/text.rb +22 -8
- data/lib/appium_lib/ios/xcuitest/element/textfield.rb +18 -4
- data/lib/appium_lib/ios/xcuitest/helper.rb +14 -0
- data/lib/appium_lib/sauce_labs.rb +14 -0
- data/lib/appium_lib/version.rb +16 -2
- data/release_notes.md +7 -0
- metadata +4 -4
data/lib/appium_lib.rb
CHANGED
@@ -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
|
-
|
4
|
-
|
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 [
|
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<
|
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 [
|
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 [
|
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(
|
62
|
+
button_index = tags(BUTTON).length
|
46
63
|
button_index -= 1 if button_index > 0
|
47
|
-
image_button_index = tags(
|
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 [
|
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<
|
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(#{
|
84
|
-
"new UiSelector().className(#{
|
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(#{
|
87
|
-
"new UiSelector().className(#{
|
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
|
93
|
-
image_button = string_visible_exact
|
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
|
99
|
-
image_button = string_visible_contains
|
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
|
-
|
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
|
26
|
+
return ele_index TEXT_VIEW, value if value.is_a? Numeric
|
12
27
|
|
13
|
-
complex_find_contains
|
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<
|
34
|
+
# @return [Array<TEXT_VIEW>]
|
20
35
|
def texts(value = false)
|
21
|
-
return tags
|
36
|
+
return tags TEXT_VIEW unless value
|
22
37
|
|
23
|
-
complex_finds_contains
|
38
|
+
complex_finds_contains TEXT_VIEW, value
|
24
39
|
end
|
25
40
|
|
26
41
|
# Find the first TextView.
|
27
|
-
# @return [
|
42
|
+
# @return [TEXT_VIEW]
|
28
43
|
def first_text
|
29
|
-
first_ele
|
44
|
+
first_ele TEXT_VIEW
|
30
45
|
end
|
31
46
|
|
32
47
|
# Find the last TextView.
|
33
|
-
# @return [
|
48
|
+
# @return [TEXT_VIEW]
|
34
49
|
def last_text
|
35
|
-
last_ele
|
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 [
|
55
|
+
# @return [TEXT_VIEW]
|
41
56
|
def text_exact(value)
|
42
|
-
complex_find_exact
|
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<
|
62
|
+
# @return [Array<TEXT_VIEW>]
|
48
63
|
def texts_exact(value)
|
49
|
-
complex_finds_exact
|
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
|
-
|
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 [
|
23
|
+
# @return [EDIT_TEXT]
|
9
24
|
def textfield(value)
|
10
|
-
return ele_index
|
25
|
+
return ele_index EDIT_TEXT, value if value.is_a? Numeric
|
11
26
|
|
12
|
-
complex_find_contains
|
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<
|
33
|
+
# @return [Array<EDIT_TEXT>]
|
19
34
|
def textfields(value = false)
|
20
|
-
return tags
|
35
|
+
return tags EDIT_TEXT unless value
|
21
36
|
|
22
|
-
complex_finds_contains
|
37
|
+
complex_finds_contains EDIT_TEXT, value
|
23
38
|
end
|
24
39
|
|
25
40
|
# Find the first EditText.
|
26
|
-
# @return [
|
41
|
+
# @return [EDIT_TEXT]
|
27
42
|
def first_textfield
|
28
|
-
first_ele
|
43
|
+
first_ele EDIT_TEXT
|
29
44
|
end
|
30
45
|
|
31
46
|
# Find the last EditText.
|
32
|
-
# @return [
|
47
|
+
# @return [EDIT_TEXT]
|
33
48
|
def last_textfield
|
34
|
-
last_ele
|
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 [
|
54
|
+
# @return [EDIT_TEXT]
|
40
55
|
def textfield_exact(value)
|
41
|
-
complex_find_exact
|
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<
|
61
|
+
# @return [Array<EDIT_TEXT>]
|
47
62
|
def textfields_exact(value)
|
48
|
-
complex_finds_exact
|
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(
|
21
|
-
e = find_elements :xpath, _button_contains_string_xpath(
|
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(
|
36
|
-
e = find_elements :xpath, _button_contains_string_xpath(
|
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::
|
65
|
+
button_index = tags(::Appium::Android::BUTTON).length
|
52
66
|
button_index -= 1 if button_index > 0
|
53
|
-
image_button_index = tags(::Appium::Android::
|
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(
|
65
|
-
e = find_elements :xpath, _button_exact_string_xpath(
|
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(
|
77
|
-
e = find_elements :xpath, _button_exact_string_xpath(
|
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, "//#{
|
97
|
-
i = find_elements :xpath, "//#{
|
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)
|