# encoding: utf-8 # UIAButton methods # Find a button by text and optionally number. # @param text [String, Integer] the text to exactly match. If int then the button at that index is returned. # @param number [Integer] the occurance of the button matching text. Defaults to the first button. # @return [Button] the button found with text and matching number def button text, number=0 # return button at index. return ele_index :button, text if text.is_a? Numeric number >= 1 ? button_num( text, number ) : find_ele_by_text_include( :button, text ) end # Get an array of button texts or button elements if text is provided. # @param text [String] the text to exactly match # @return [Array, Array] either an array of button texts or an array of button elements if text is provided. def buttons text=nil text == nil ? find_eles_attr( :button, :text ) : find_eles_by_text_include( :button, text ) end # Get the first button element. # @return [Button] def first_button first_ele :button end # Get the last button element. # @return [Button] def last_button last_ele :button end # Get the first button element that exactly matches text. # @param text [String] the text to match exactly # @return [Button] def button_exact text find_ele_by_text :button, text end # Get all button elements that exactly match text. # @param text [String] the text to match exactly # @return [Array