Sha256: e4865840757fa5f9f813c0b8f037681ff1d2b2e3f18890577cc4179a5a4c4ba7

Contents?: true

Size: 807 Bytes

Versions: 23

Compression:

Stored size: 807 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)

          selectors[:type] = Watir::Button::VALID_TYPES
          input_attr_exp = xpath_builder.attribute_expression(:input, selectors)

          xpath = ".//button"
          xpath << "[#{button_attr_exp}]" unless button_attr_exp.empty?
          xpath << " | .//input"
          xpath << "[#{input_attr_exp}]"

          p build_wd_selector: xpath if $DEBUG

          [:xpath, xpath]
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
watir-6.0.0.beta1 lib/watir/locators/button/selector_builder.rb
watir-webdriver-0.9.3 lib/watir-webdriver/locators/button/selector_builder.rb
watir-webdriver-0.9.2 lib/watir-webdriver/locators/button/selector_builder.rb