Sha256: 7a1cb6788f07ea7e2ee421d75a4aaa46e4d3a8cac8995fccd391f1a31e2dc140

Contents?: true

Size: 961 Bytes

Versions: 30

Compression:

Stored size: 961 Bytes

Contents

module Watir
  module Locators
    class TextField
      class Locator < Element::Locator
        def locate_all
          find_all_by_multiple
        end

        private

        def wd_find_first_by(how, what)
          how, what = selector_builder.build_wd_selector(how => what) if how == :tag_name
          super
        end

        def matches_selector?(element, rx_selector)
          rx_selector = rx_selector.dup

          tag_name = element.tag_name.downcase

          [:text, :value, :label].each do |key|
            if rx_selector.key?(key)
              correct_key = tag_name == 'input' ? :value : :text
              rx_selector[correct_key] = rx_selector.delete(key)
            end
          end

          super
        end

        def by_id
          element = super

          if element && !Watir::TextField::NON_TEXT_TYPES.include?(element.attribute(:type))
            element
          end
        end
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
watir-6.9.1 lib/watir/locators/text_field/locator.rb
watir-6.9.0 lib/watir/locators/text_field/locator.rb
watir-6.8.4 lib/watir/locators/text_field/locator.rb
watir-6.8.3 lib/watir/locators/text_field/locator.rb
watir-6.8.2 lib/watir/locators/text_field/locator.rb
watir-6.8.1 lib/watir/locators/text_field/locator.rb
watir-6.8.0 lib/watir/locators/text_field/locator.rb
watir-6.7.3 lib/watir/locators/text_field/locator.rb
watir-6.7.2 lib/watir/locators/text_field/locator.rb
watir-6.7.1 lib/watir/locators/text_field/locator.rb
watir-6.7.0 lib/watir/locators/text_field/locator.rb
watir-6.6.3 lib/watir/locators/text_field/locator.rb
watir-6.6.2 lib/watir/locators/text_field/locator.rb
watir-6.6.1 lib/watir/locators/text_field/locator.rb
watir-6.6.0 lib/watir/locators/text_field/locator.rb
watir-6.5.0 lib/watir/locators/text_field/locator.rb
watir-6.4.3 lib/watir/locators/text_field/locator.rb
watir-6.4.2 lib/watir/locators/text_field/locator.rb
watir-6.4.1 lib/watir/locators/text_field/locator.rb
watir-6.4.0 lib/watir/locators/text_field/locator.rb