Bill, et al.
Thanks very much for the help, this is what I ended up with.
--code--
def get_window_not_named(title)
loop do
begin
window = Watir::IE.attach(:title, //)
return window if window.title != title
rescue Watir::NoMatchingWindowFoundException
break
end
end
return nil
end
--code--
/Mike
-----Original Message-----
On 3/23/06, Mike Kolcun <[EMAIL PROTECTED]> wrote:
>
> I've got a situation where I have a the main window of an application that
> pops up a new window using a JavaScript call on the click of a form
button.
>
> The title of this new window varies from time to time with what I'm
testing,
> so I'm not able to just attach to the title of the window. The url is
also
> different, so that option is out too.
>
> Is there a way to get a handle for "the most recently opened window" or
> something of the like?
If it's safe to assume that the only two browser windows open will be
the parent window and the popup window, then the following example
might work for you. There may be a more graceful way to do this, but
this seemed to work when I tested it out. Also, if more than two
windows are open, then it will probably not do the right thing,
either. :) In that case it may match the wrong window.
The technique of using the regexp "//" to loop through all browsers is
from an example for closing all open browsers that someone posted to
the list a while ago.
--snipped code--
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general