Module: Appium::Core::Base::SearchContext
- Included in:
- Driver, Selenium::WebDriver::Element
- Defined in:
- lib/appium_lib_core/common/base/search_context.rb
Constant Summary collapse
- FINDERS =
referenced: ::Selenium::WebDriver::SearchContext
::Selenium::WebDriver::SearchContext::FINDERS.merge( accessibility_id: 'accessibility id', image: '-image', custom: '-custom', # Android uiautomator: '-android uiautomator', # Unavailable in Espresso viewtag: '-android viewtag', # Available in Espresso # iOS uiautomation: '-ios uiautomation', predicate: '-ios predicate string', class_chain: '-ios class chain', # Windows windows_uiautomation: '-windows uiautomation', # Tizen tizen_uiautomation: '-tizen uiautomation' )
Instance Method Summary collapse
-
#find_element(*args) ⇒ Element
Find the first element matching the given arguments.
-
#find_elements(*args) ⇒ Object
Find all elements matching the given arguments.
Instance Method Details
#find_element(how, what) ⇒ Element #find_element(opts) ⇒ Element
Find the first element matching the given arguments
Android can find with uiautomator like a [UISelector](developer.android.com/tools/help/uiautomator/UiSelector.html). iOS can find with a [UIAutomation command](developer.apple.com/library/ios/documentation/ToolsLanguages/Reference/UIAWindowClassReference/UIAWindow/UIAWindow.html#//apple_ref/doc/uid/TP40009930). iOS, only for XCUITest(WebDriverAgent), can find with a [class chain]( github.com/facebook/WebDriverAgent/wiki/Queries)
Find with image. Return an element if current view has a partial image. The logic depends on template matching by OpenCV. You can handle settings for the comparision following below.
92 93 94 95 96 97 98 99 100 |
# File 'lib/appium_lib_core/common/base/search_context.rb', line 92 def find_element(*args) how, what = extract_args(args) by = _set_by_from_finders(how) begin bridge.find_element_by by, what.to_s, ref rescue Selenium::WebDriver::Error::TimeOutError raise Selenium::WebDriver::Error::NoSuchElementError end end |
#find_elements(*args) ⇒ Object
Find all elements matching the given arguments
107 108 109 110 111 112 113 114 115 |
# File 'lib/appium_lib_core/common/base/search_context.rb', line 107 def find_elements(*args) how, what = extract_args(args) by = _set_by_from_finders(how) begin bridge.find_elements_by by, what.to_s, ref rescue Selenium::WebDriver::Error::TimeOutError [] end end |