Sha256: 6ffd4d793b57eb83a2010c8797a69a1a505b060498c7f8521da2370a78ee65dc

Contents?: true

Size: 889 Bytes

Versions: 46

Compression:

Stored size: 889 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

46 entries across 46 versions & 2 rubygems

Version Path
watir-webdriver-0.3.2 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.3.1 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.3.0 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.2.9 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.2.8 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.2.7 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.2.6 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.2.5 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.2.4 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.2.3 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.2.2 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.2.1 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.2.0 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.2.0.dev2 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.2.0.dev lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.1.9 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.1.8 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.1.7 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.1.6 lib/watir-webdriver/elements/table_row.rb
watir-webdriver-0.1.5 lib/watir-webdriver/elements/table_row.rb