Sha256: 8e1065d6b01b765e148147d75f82dcab02ec199a308702593dc0c5b07db7b6e5

Contents?: true

Size: 850 Bytes

Versions: 4

Compression:

Stored size: 850 Bytes

Contents

module Watir
  module Locators
    class Row
      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?!")

          tag_name = @query_scope.tag_name.downcase
          expressions = %w[./tr]
          unless %w[tbody tfoot thead].include?(tag_name)
            expressions += %w[./tbody/tr ./thead/tr ./tfoot/tr]
          end

          attr_expr = xpath_builder.attribute_expression(nil, selectors)

          unless attr_expr.empty?
            expressions.map! { |e| "#{e}[#{attr_expr}]" }
          end

          xpath = expressions.join(" | ")

          p build_wd_selector: xpath if $DEBUG

          [:xpath, xpath]
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
watir-6.12.0 lib/watir/locators/row/selector_builder.rb
watir-6.11.0 lib/watir/locators/row/selector_builder.rb
watir-6.11.0.beta2 lib/watir/locators/row/selector_builder.rb
watir-6.11.0.beta1 lib/watir/locators/row/selector_builder.rb