def click_button_with_caption(caption, opts={})
        all_buttons = button_elements
        matching_buttons = all_buttons.select{|x| x.attribute('value') == caption}
        if matching_buttons.size > 0

          if opts && opts[:index]
						the_index = opts[:index].to_i() - 1
            puts "Call matching buttons: #{matching_buttons.inspect} => #{the_index}"
            first_match = matching_buttons[the_index]
            first_match.click
					else
	          the_button = matching_buttons[0]
	          the_button.click
          end

        else
          raise "No button with value: #{caption} found"
        end
      end
def click_button_with_caption(caption, opts={})
        all_buttons = button_elements
        matching_buttons = all_buttons.select{|x| x.attribute('value') == caption}
        if matching_buttons.size > 0

          if opts && opts[:index]
						the_index = opts[:index].to_i() - 1
            puts "Call matching buttons: #{matching_buttons.inspect} => #{the_index}"
            first_match = matching_buttons[the_index]
            first_match.click
					else
	          the_button = matching_buttons[0]
	          the_button.click
          end

        else
          raise "No button with value: #{caption} found"
        end
      end
Click a button with caption

 TODO: Caption is same as value

 Usage:
   click_button_with_caption("Confirm payment")