module Appium::Ios
def find text
-
(Element)
- the first matching element
Parameters:
-
text
(String
) -- the text to search for
def find text ele = nil # prefer value search. this may error with: # Can't use in/contains operator with collection 1 js = first_ele_js "value contains[c] '#{text}'" ele = ignore { execute_script js } # now search name and label if the value search didn't match. unless ele js = first_ele_js "name contains[c] '#{text}' || label contains[c] '#{text}'" ele = ignore { execute_script js } end # manually raise error if no element was found raise Selenium::WebDriver::Error::NoSuchElementError, 'An element could not be located on the page using the given search parameters.' unless ele ele end