|
|
|
[
Permlink
| « Hide
]
Charley Baker - 29/Apr/06 10:18 PM
Orginally reported on Rubyforge: http://rubyforge.org/tracker/index.php?func=detail&aid=2177&group_id=104&atid=487
Proposed solution looks right.
However, we really should do this in conjuction with also providing child_rows (and child_cells) which would have a number of rows corresponding to this count. Indeed once this were done, we arguably should deprecate row_count in favor of the child_rows.count, which is more rubyish. Brett,
As I'd discussed with you I'm seeing a poblem with a method that reads text from a table. It loops through the rows in a table, and then moves on to the next table untilthe matching text is found. while(iRowIndex <= $ie.table(:index, iTableIndex).row_count) aRowText = ($ie.table(:index, iTableIndex).row_values(iRowIndex)) end In each case I investigated when this method fails the page contains nested tables, and the error occurred when trying to read text from a row of the table that contains a nested table. Sadly the practice of nesting tables is pretty common, some pages I've looked at have 8-levels of nests (not exactly W3.org compliant) The error when using the row_values method to read the text from the table's row when that table contains a nested table is: E, [19-May-2008 11:39:25#180] ERROR -- : Error and Backtrace: unknown property or method `1' HRESULT error code:0x80020006 Unknown name. c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1230/./watir.rb:3274:in `[]' c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1230/./watir.rb:3274:in `row' c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1230/./watir.rb:3236:in `column_count' c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1230/./watir.rb:3292:in `row_values' I was able to pair down an example to only three tables on the page. Each time the method errors is when that table contains a nested table. For example: Table 1 has 1 Row, and 1 Column, and contains a nested table (Table 2) in that column Table 2 also has 1 Row and 1 Column, and contains a third nested table (Table 3). Table 3 has 2 rows, (each with 1 column apiece). So when it loops to read the text from the rows of the inner most nested table (Table 3) it works fine, But when looping through the rows in Table 2 the error occurs once a on-existent row is reached. I had the code display the number of rows in Table 2 using row_count, and it was incorrectly reporting more rows that it directly contains (presumably its counting its own row along with the rows from the nested table) I don't think that we should fix this issue, because it does not rely on web standards. A work around has already been supplied, and I believe that should be sufficient -- we can place that in the wiki for people who DO need to test web pages with nested tables. Please reference http://groups.google.com/group/watir-general/browse_thread/thread/367af314e9c1d017 for more information. I ran a simple W3C validation test on a small XHTML transitional file both containing nested tables and without nested tables, and the one without nested tables validated successfully on W3C's HTML validator, whereas the one WITH nested tables was invalid according to W3C's validator. I don't see a way to vote against this, but if it isn't supported by web standards, I don't thing that we should pursue it strongly. That isn't only my opinion. More references: http://veerle.duoh.com/blog/comments/starting_with_css_and_bug_fixing_tips/ and http://alistapart.com/articles/tohell/
Added new method row_count_excluding_nested_tables to Watir::Table. This will be included in Watir 1.6.
|
|||||||||||||||||||||||||||||||||||||||||||||||