Brian,

The modal_dialog method uses a Win32 call that locates any popup window 
using your current IE window's  handle (HWND).  I had originally coded 
the (:hwnd, hwnd) parameters in addition to the version with no 
parameters, but they really do the same thing since there can only be 
*one* active popup at any time (though a modal dialog can bring up it's 
OWN modal dialog, but the second one will then become the only one you 
can attach to).

Once you've attached to a modal dialog your second question is easy.  
You operate on a modal dialog the *same* way you'd operate against your 
normal IE window.  This is because a modal dialog uses the same DOM 
model and loads from an HTML file.  The hard part about modal dialogs 
was that there was no easy way to attach to them and get a good handle 
to the DOM, but I found some special code written by Yaxin Wang which 
does some fancy C++ casting to give us the same type of handle.

Javascript or browser popups are different as they aren't based on HTML, 
so other methods are required to handle those, but once you attach to 
them, modal dialogs are easy!

David

[EMAIL PROTECTED] wrote:
> Hey
>
> In that case, how do I fetch a ModelDialog instance of the popup after
> calling click_no_wait on the IE instance?
>
>
> -----Original Message-----
> From: "Charley Baker" <[EMAIL PROTECTED]>
> Sent: Fri, September 15, 2006 7:25
> To: [email protected]
> Subject: Re: [Wtr-general] watir-1.5.1.1081.gem and popups
>
> You've pretty much answered your own question - only null and :title
> methods are supported.
> modal = ie.modal_dialog   # or use the :title location method to find by
> title
> modal.close
>
> Look at modal_dialog_test.rb in the unit tests if you need more
> information and examples.
>
> -Charley
>
>
> On 9/15/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>   
>> Hi
>>
>> Could some please explain how to find and close a modal dialog using
>> watir-1.5.1.1081.gem.
>>
>> When I try to find the dialog using the line 'ie2 = ie.modal_dialog(:hwnd,
>> hwnd) ' ruby returns the error 'Only null and :title methods are supported
>> (ArgumentError)'
>>
>> Thanks
>>     

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to