lib/watirspec/watir.rb in watirspec-0.1.1 vs lib/watirspec/watir.rb in watirspec-0.1.2

- old
+ new

@@ -84,32 +84,31 @@ # # It works with tr, th, td elements, colspan, rowspan and nested tables. def to_a assert_exists y = [] - @o.getElementsByTagName("TR").each do |row| - # make sure that this row is directly child element of the table - # and not from some inner table - next unless row.parentElement.parentElement.uniqueID == @o.uniqueID - + @o.rows.each do |row| y << TableRow.new(@container, :ole_object, row).to_a end y end end class TableRow < Element - # This method returns (multi)-dimensional array of the text's in table row. + # 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. def to_a assert_exists y = [] @o.cells.each do |cell| inner_tables = cell.getElementsByTagName("TABLE") inner_tables.each do |inner_table| - y << Watir::Table.new(@container, :ole_object, inner_table).to_a + # make sure that the inner table is directly child for this cell + if inner_table.parentElement.uniqueID == cell.uniqueID + y << Table.new(@container, :ole_object, inner_table).to_a + end end if inner_tables.length == 0 y << cell.innerText.strip end \ No newline at end of file