Module: Watir::TableContainer

Included in:
Table, TableSection
Defined in:
lib/watir-classic/table.rb

Instance Method Summary collapse

Instance Method Details

#[](index) ⇒ TableRow

Returns a row in the Watir::Table.

Parameters:

  • index (Fixnum)

    row number to retrieve.

Returns:



7
8
9
10
# File 'lib/watir-classic/table.rb', line 7

def [](index)
  assert_exists
  TableRow.new(self, :ole_object => @o.rows.item(index))
end

#stringsArray<String>

Returns array of table element texts.

Returns:

  • (Array<String>)

    array of table element texts.



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/watir-classic/table.rb', line 14

def strings
  assert_exists
  rows_memo = []
  @o.rows.each do |row|
    cells_memo = []
    row.cells.each do |cell|
      cells_memo << TableCell.new(self, :ole_object => cell).text.gsub("\r\n","")
    end
    rows_memo << cells_memo
  end
  rows_memo
end