Skip to content

Commit c13b877

Browse files
Merge pull request #137 from DylanLacey/accessibility_id
Add accessiblity_id finder
2 parents 5d1722f + 5c9d18f commit c13b877

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/appium_lib/device/device.rb

+14
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ def remove(id)
3535
execute :remove, {}, :appId => id
3636
end
3737
end
38+
39+
extend_search_contexts
3840
end
3941

4042
def add_endpoint_method(method, path)
@@ -98,6 +100,18 @@ def log_reimplemented_warning(method, path)
98100
msg << " Raise an issue at http://github.com/appium/ruby_lib if so."
99101
Appium::Logger.warn msg
100102
end
103+
104+
# @!method accessiblity_id_find
105+
# find_element/s with their accessibility_id
106+
#
107+
# ```ruby
108+
# find_elements :accessibility_id, 'Animation'
109+
# ```
110+
def extend_search_contexts
111+
Selenium::WebDriver::SearchContext.class_eval do
112+
Selenium::WebDriver::SearchContext::FINDERS[:accessibility_id] = 'accessibility id'
113+
end
114+
end
101115
end
102116
end
103117
end

0 commit comments

Comments
 (0)