Skip to content

Commit bc1cdb1

Browse files
Add find_eles_attr
1 parent e89f8bd commit bc1cdb1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/appium_lib/helper.rb

+7-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,12 @@ def find_eles_attr tag_name, attribute
7777
)
7878

7979
$driver.execute_script js
80-
end
80+
end if $os == :ios
81+
82+
def find_eles_attr tag_name, attribute
83+
# on android, assume the attr is name (which falls back to text).
84+
mobile :find, [ 'all', [ [26, "(?i).*#{tag_name}.*"], [100] ] ]
85+
end if $os == :android
8186

8287
# iOS only. Android uses uiautomator instead of uiautomation.
8388
# Get an array of attribute values from elements exactly matching tag name.
@@ -99,7 +104,7 @@ def find_2_eles_attr tag_name_1, tag_name_2, attribute
99104
)
100105

101106
$driver.execute_script js
102-
end
107+
end if $os == :ios # Android doesn't use find_2_eles_attr
103108

104109
# Get the first tag that exactly matches tag and text.
105110
# @param tag [String] the tag name to match

0 commit comments

Comments
 (0)