lib/appium_lib/android/espresso/element/button.rb
# Find the first button that contains value or by index.
# @param value [String, Integer] the value to exactly match.
# If int then the button at that index is returned.
# @return [Button]
Find the first button that contains value or by index.
Find the first button that contains value or by index .
def button(value)
          if value.is_a? Numeric
            index = value
            raise "#{index} is not a valid index. Must be >= 1" if index <= 0
            _button_visible_selectors_xpath(index: index - 1)
          end
          i = find_elements :xpath, _button_contains_string_xpath(BUTTON, value)
          e = find_elements :xpath, _button_contains_string_xpath(IMAGE_BUTTON, value)
          raise_no_such_element_if_empty(i + e)
          (i + e)[0]
        end
def button ( value ) if value . is_a? Numeric index = value raise "#{index} is not a valid index. Must be >= 1" if index <= 0 _button_visible_selectors_xpath ( index : index - 1 ) end i = find_elements :xpath , _button_contains_string_xpath ( BUTTON , value ) e = find_elements :xpath , _button_contains_string_xpath ( IMAGE_BUTTON , value ) raise_no_such_element_if_empty ( i + e ) ( i + e ) [ 0 ] end
Find the first button that contains value or by index.
Find the first button that contains value or by index .
# Don't use ele_index because that only works on one element type. # Android needs to combine button and image button to match iOS. # zero index
None
Button
value
the value to exactly match. If int then the button at that index is returned.
the value to exactly match . If int then the button at that index is returned .