On 6/14/06, Manish Sapariya <[EMAIL PROTECTED]> 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?).

The list of tables is created when you call "ie.tables". The list is actually a list of COM references to the tables. What this means is that if you do anything inside the each block that causes a page to load, the remaining COM table references will be stale and you will get OLE errors if you try to do anything with them. Also if you try to save these references in an array or something, they will be worthless after the next page load.

I'm not sure if this information relates to the reason for your question, or not, but it does explain a common source of problems.

Bret
_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to