[Wtr-general] Problem with attach using ":title"

marekj marekj.com at gmail.com
Mon Jul 2 16:20:09 EDT 2007


a quick question about attaching to the session of IE.
I am currently relying on attaching to one window on the desktop but I want
to move towards running -b(ackground) option of Watir and running multiple
IE windows. The best way I think I can do this is to maintain a handle to
each IE instance. On my setup script that starts IE instance I can write out
:hwnd and mainaint my test session based on that so each script talk to the
correct window.

Before I jump into doing this I want to find out if it's possible to do in
with -b option and if I am on the right track.

so for example
I will do this in my startup
$ie = Watir.start()
$ie_hwnd = $ie.hwnd()

then in my test cases I attach to the instance
$ie = Watir::IE.attach(:hwnd, $ie_hwnd)

Then I can run another script file containing testCases with the same code.

So this will create another thread of execution and each thread will have
$ie attached to different instance of IE in memory.
Am I on the right track?
Your ideas are much appreciated.
Thanks
marekj





On 6/30/07, Bret Pettichord <bret at pettichord.com> wrote:
>
> jim_matt wrote:
> > I wanted to share something I discovered.  I had reported earlier that
> > I sometimes I had problems attaching a browser using ":title".  The
> > problem turns out to be that "title" is part of the HTML.  The
> > confusion comes because if the HTML does not have a title,  IE
> > displays the URL in the title bar of the browser.  This makes it look
> > like you should be able to attach the IE browser using ":title", but
> > the attach will fail with an error like:
> >
> > Watir::Exception::NoMatchingWindowFoundException: Unable to locate a
> > window with title of (?i-mx:<whatever you used to match>)
> >
> > This is worth a note in the documentation for matching on ":title"
> > because it certainly looks like it should work.
> >
> This report is correct (we've discussed this offline). Both the
> IE.attach and the ie.title method are consistent in this regard -- both
> consider the title to be the HTML title of the page, which is not
> necessarily what appears in the title bar.
>
> Bret
> _______________________________________________
> Wtr-general mailing list
> Wtr-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070702/5c757b8e/attachment.html 


More information about the Wtr-general mailing list