Manish,

Since I've been digging around in this code I'll take a stab at 
answering your question.

Currently, Watir does use a DOM call to build the element collections 
(like "tables", "cells", "rows", "links", etc).  That call is 
getElementsByTagName() 
(http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/getelementsbytagname.asp).
  
However, we are looking at modifying that behavior slightly because the 
getElementsByTagName() method returns ALL child and nested child 
elements with the specified tag are returned, even if they are many 
levels deeper.

This has caused problems with things like table rows where there is a 
sub-table contained within a table (a common occurance).  When this 
happens, the row_count will show the count of ALL the rows, not just the 
number of rows in the current table.  I currently have a question on the 
wtr-development list asking for feedback on how best to handle this 
situation.

Hopefully we can come up with a good solution that allows you to find 
ANY element in the entire page (like "ie.row(:id, 'thisRow')") and yet 
have a correct row_count for a table ("ie.table(:id, 
'myTable').row_count") and only allow indexing to direct children 
("ie.table(:id, 'myTable')[2]").

David

Manish Sapariya wrote:
> Hi,
> I was wondering how watir maintains and creates the list of controls it 
> sees on a page.
> I am not sure whether this functionality is directly provided by the 
> WebBrowser
> control or watir does some magic to get the lists of various controls. 
> To illustrate
>
> when I say
>
> ie.tables.each { |t|
>     do something with each table
> }
>
> Does watir create the list of tables and other control when it is 
> finished loading a page
> or WebBrowser control itself exposes this functionality (I actually 
> doubt it?). If WebBrowser
> does not expose this functionality, where in watir.rb is the code to 
> construct this lists?
>   
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to