Sha256: 67a686905f59f9359dc4b00917282cc6ed95af6876b7308b8986a22dc9a7176e

Contents?: true

Size: 987 Bytes

Versions: 1

Compression:

Stored size: 987 Bytes

Contents

module Watir
  module Locators
    class Button
      class SelectorBuilder < Element::SelectorBuilder
        def build_wd_selector(selectors)
          return if selectors.values.any? { |e| e.kind_of? Regexp }

          selectors.delete(:tag_name) || raise("internal error: no tag_name?!")

          button_attr_exp = xpath_builder.attribute_expression(:button, selectors)
          
          xpath = ".//button"
          xpath << "[#{button_attr_exp}]" unless button_attr_exp.empty?
          
          unless selectors[:type] == false
            selectors[:type] = Watir::Button::VALID_TYPES if [nil, true].include?(selectors[:type])
            input_attr_exp = xpath_builder.attribute_expression(:input, selectors)
            
            xpath << " | .//input"
            xpath << "[#{input_attr_exp}]"
          end
          
          p build_wd_selector: xpath if $DEBUG

          [:xpath, xpath]
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
watir-6.10.1 lib/watir/locators/button/selector_builder.rb