Sha256: c20e765c5f3d982c3638bf34481d98a59442d2e31e40b3ca31e92855e7ba5f50

Contents?: true

Size: 905 Bytes

Versions: 2

Compression:

Stored size: 905 Bytes

Contents

module Watir
  module Locators
    class Button
      class Locator < Element::Locator
        private

        def using_selenium(*)
          # force watir usage
        end

        def matches_values?(element, values_to_match)
          return super unless values_to_match.key?(:value)

          copy = values_to_match.dup
          value = copy.delete(:value)

          everything_except_value = super(element, copy)

          matches_value = fetch_value(element, :value) =~ /#{value}/
          matches_text = fetch_value(element, :text) =~ /#{value}/
          if matches_text
            Watir.logger.deprecate(':value locator key for finding button text',
                                   'use :text locator',
                                   ids: [:value_button])
          end

          everything_except_value && (matches_value || matches_text)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
watir-6.15.1 lib/watir/locators/button/locator.rb
watir-6.15.0 lib/watir/locators/button/locator.rb