Sha256: 70fcf2c283c21681d08e9214c8c7a7aa1848ad485405a25a15e20d9d8303fe79

Contents?: true

Size: 957 Bytes

Versions: 23

Compression:

Stored size: 957 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

23 entries across 23 versions & 1 rubygems

Version Path
watir-6.13.0 lib/watir/locators/button/selector_builder.rb
watir-6.12.0 lib/watir/locators/button/selector_builder.rb
watir-6.11.0 lib/watir/locators/button/selector_builder.rb
watir-6.11.0.beta2 lib/watir/locators/button/selector_builder.rb
watir-6.11.0.beta1 lib/watir/locators/button/selector_builder.rb
watir-6.10.3 lib/watir/locators/button/selector_builder.rb
watir-6.10.2 lib/watir/locators/button/selector_builder.rb
watir-6.10.0 lib/watir/locators/button/selector_builder.rb
watir-6.9.1 lib/watir/locators/button/selector_builder.rb
watir-6.9.0 lib/watir/locators/button/selector_builder.rb
watir-6.8.4 lib/watir/locators/button/selector_builder.rb
watir-6.8.3 lib/watir/locators/button/selector_builder.rb
watir-6.8.2 lib/watir/locators/button/selector_builder.rb
watir-6.8.1 lib/watir/locators/button/selector_builder.rb
watir-6.8.0 lib/watir/locators/button/selector_builder.rb
watir-6.7.3 lib/watir/locators/button/selector_builder.rb
watir-6.7.2 lib/watir/locators/button/selector_builder.rb
watir-6.7.1 lib/watir/locators/button/selector_builder.rb
watir-6.7.0 lib/watir/locators/button/selector_builder.rb
watir-6.6.3 lib/watir/locators/button/selector_builder.rb