class Watir::Locators::Button::Matcher

Public Instance Methods

deprecate_value_button() click to toggle source
# File lib/watir/locators/button/matcher.rb, line 22
def deprecate_value_button
  Watir.logger.deprecate(':value locator key for finding button text',
                         'use :text locator',
                         ids: [:value_button])
end
elements_match?(element, values_to_match) click to toggle source
Calls superclass method
# File lib/watir/locators/button/matcher.rb, line 5
def elements_match?(element, values_to_match)
  copy_values_to_match = values_to_match.dup
  value = copy_values_to_match.delete(:value)

  if value
    matching = matches_values?(fetch_value(element, :text), value)
    deprecate_value_button if matching

    matching ||= matches_values?(fetch_value(element, :value), value)

    return false unless matching
    return true if copy_values_to_match.empty?
  end

  super(element, copy_values_to_match)
end
validate_tag(element, _expected) click to toggle source
# File lib/watir/locators/button/matcher.rb, line 28
def validate_tag(element, _expected)
  tag_name = fetch_value(element, :tag_name)
  return unless %w[input button].include?(tag_name)

  # TODO: - Verify this is desired behavior based on https://bugzilla.mozilla.org/show_bug.cgi?id=1290963
  return if tag_name == 'input' && !Watir::Button::VALID_TYPES.include?(element.attribute('type').downcase)

  element
end