Class: Watir::TableRow

Inherits:
Element
  • Object
show all
Defined in:
lib/watirspec/watir.rb

Instance Method Summary collapse

Instance Method Details

#to_aObject

This method returns (multi-dimensional) array of the text’s in table’s row.

It works with th, td elements, colspan, rowspan and nested tables.



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/watirspec/watir.rb', line 118

def to_a
  assert_exists
  y = []
  @o.cells.each do |cell|
    inner_tables = cell.getElementsByTagName("TABLE")
    inner_tables.each do |inner_table|
      # make sure that the inner table is directly child for this cell

      if inner_table?(cell, inner_table)
        y << Table.new(@container, :ole_object, inner_table).to_a
      end
    end

    if inner_tables.length == 0
      y << cell.innerText.strip
    end
  end
  y
end