The code base in development allows you to configure this. IE.attach_timeout = 10
This is number of seconds to wait for the window specified in attach statements to appear/load. This should be exactly what you are asking for. Paul, Mark, Anyone: Lemme know happens if you try this out. Does it solve your problem? (There is a lot of great stuff in development, which is why i'm eager to stabilize the code base and make a new release.) Bret On 3/20/06, Paul Carvalho <[EMAIL PROTECTED]> wrote: > Hello again, > > I am having a bit of difficulty getting my script to wait for a window to > finish loading before attaching to it. Here's the original code: > ---- > $ie.link(:text, 'View Report').click > > ie2 = IE.attach(:title, /View Report/) > > # stuff happens > > ie2.close > ---- > > If I run it as above, I get the following error: > "Watir::Exception::NoMatchingWindowFoundException: Unable > to locate a window with title of (?-mix:View Report)" > > The problem seems to be that the Title bar initially has a URL displayed in > it and then, after a while (random number of seconds), it updates to the > correct <TITLE>. So the command will *eventually* work, but it will fail if > it checks the window too soon. > > I tried inserting a 'sleep' command between the first two lines above, but I > can't account for how long it will take the window to finish loading. > > I searched the message archives but I couldn't find anything that helps me > tell the script to wait as long as it needs before trying to attach to the > new window. > > I tried making up combinations of functions to try and help me, but so far > nothing has helped. For example, I tried working with commands like: > > IE.attach(:title, /View Report/).exists? # but this doesn't work as > I'd like > > and the ie.status() method only applies when you can actually connect to the > window first, so it doesn't help me either. > > I thought about creating a series of nested begin-rescue-end blocks to catch > and work with the exceptions, but I still couldn't quite figure out how to > get it to wait the random amount of time required before trying to attach to > the window. > > Has anyone else encountered a similar problem before? Do you have any > suggestions that might help? > > Please let me know. Thanks. > Paul. > > > _______________________________________________ > Wtr-general mailing list > [email protected] > http://rubyforge.org/mailman/listinfo/wtr-general > > _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
