Sha256: a307a1f1c8ef600d9f3bcfcf5cae8fb49e958faf1635ec4bd0ee18b5bc8f5621

Contents?: true

Size: 815 Bytes

Versions: 6

Compression:

Stored size: 815 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?!")

          expressions = %w[./tr]
          unless %w[tbody tfoot thead].include?(@parent.tag_name.downcase)
            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

6 entries across 6 versions & 2 rubygems

Version Path
watir-webdriver-0.9.9 lib/watir-webdriver/locators/row/selector_builder.rb
watir-6.0.0.beta3 lib/watir/locators/row/selector_builder.rb
watir-6.0.0.beta2 lib/watir/locators/row/selector_builder.rb
watir-6.0.0.beta1 lib/watir/locators/row/selector_builder.rb
watir-webdriver-0.9.3 lib/watir-webdriver/locators/row/selector_builder.rb
watir-webdriver-0.9.2 lib/watir-webdriver/locators/row/selector_builder.rb