Sha256: 9528a60745d5c2265237f90af021caca403f56597372c1c5e4cda7ad5d63bc4c

Contents?: true

Size: 791 Bytes

Versions: 25

Compression:

Stored size: 791 Bytes

Contents

module Watir
  class ChildRowLocator < ElementLocator

    def locate_all
      find_all_by_multiple
    end

    private

    def by_id
      nil # avoid this
    end

    def build_xpath(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?(@wd.tag_name.downcase)
        expressions += %w[./tbody/tr ./thead/tr ./tfoot/tr]
      end

      attr_expr = attribute_expression(selectors)

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

      xpath = expressions.join(" | ")

      p :build_xpath => xpath if $DEBUG

      xpath
    end

  end # ChildRowLocator
end # Watir

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
watir-webdriver-0.5.3 lib/watir-webdriver/locators/child_row_locator.rb
watir-webdriver-0.5.2 lib/watir-webdriver/locators/child_row_locator.rb
watir-webdriver-0.5.1 lib/watir-webdriver/locators/child_row_locator.rb
watir-webdriver-0.5.0 lib/watir-webdriver/locators/child_row_locator.rb
watir-webdriver-0.4.1 lib/watir-webdriver/locators/child_row_locator.rb
watir-webdriver-0.4.0 lib/watir-webdriver/locators/child_row_locator.rb
watir-webdriver-0.3.9 lib/watir-webdriver/locators/child_row_locator.rb
watir-webdriver-0.3.8 lib/watir-webdriver/locators/child_row_locator.rb
watir-webdriver-0.3.7 lib/watir-webdriver/locators/child_row_locator.rb
watir-webdriver-0.3.6 lib/watir-webdriver/locators/child_row_locator.rb
watir-webdriver-0.3.5 lib/watir-webdriver/locators/child_row_locator.rb
watir-webdriver-0.3.4 lib/watir-webdriver/locators/child_row_locator.rb
watir-webdriver-0.3.3 lib/watir-webdriver/locators/child_row_locator.rb
watir-webdriver-0.3.2 lib/watir-webdriver/locators/child_row_locator.rb
watir-webdriver-0.3.1 lib/watir-webdriver/locators/child_row_locator.rb
watir-webdriver-0.3.0 lib/watir-webdriver/locators/child_row_locator.rb
watir-webdriver-0.2.9 lib/watir-webdriver/locators/child_row_locator.rb
watir-webdriver-0.2.8 lib/watir-webdriver/locators/child_row_locator.rb
watir-webdriver-0.2.7 lib/watir-webdriver/locators/child_row_locator.rb
watir-webdriver-0.2.6 lib/watir-webdriver/locators/child_row_locator.rb