Sha256: f0da615755b4a4799c1ebbbba5f331e7eed2b2fe76beb107e82e9af3c56c34af

Contents?: true

Size: 888 Bytes

Versions: 14

Compression:

Stored size: 888 Bytes

Contents

module Watir
  class TableRow < HTMLElement
    include CellContainer

    # @private
    attr_writer :locator_class

    #
    # Get the n'th cell (<th> or <td>) of this row
    #
    # @return Watir::TableCell
    #

    def [](idx)
      cell(:index, idx)
    end

    private

    def locator_class
      @locator_class || super
    end
  end # TableRow

  class TableRowCollection < ElementCollection
    attr_writer :locator_class

    def elements
      # we do this craziness since the xpath used will find direct child rows
      # before any rows inside thead/tbody/tfoot...
      elements = super

      if locator_class == ChildRowLocator and @parent.kind_of? Table
        elements = elements.sort_by { |row| row.attribute(:rowIndex).to_i }
      end

      elements
    end

    def locator_class
      @locator_class || super
    end
  end # TableRowCollection
end # Watir

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
watir-webdriver-0.9.1 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.9.0 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.8.0 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.7.0 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.6.11 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.6.10 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.6.9 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.6.8 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.6.7 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.6.6 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.6.5 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.6.4 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.6.3 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.6.2 lib/watir-webdriver/elements/table_row.rb