Re: [Wtr-general] watir-1.5.1.1081.gem and popups
[EMAIL PROTECTED] wrote: Hi I still can't get this to work. If I run the following code, Ruby returns the error message 'Unable to attach to Modal Window nil after 10.5 seconds' Watir::IE::attach_timeout = 10 ie = Watir::IE::new ie.goto(http://www.echoecho.com/javascript4.htm;) ie.button(:name, B1).click_no_wait modal = ie.modal_dialog What am I doing wrong? Thanks This is not the right command for this kind of dialog. The modal_dialog command is for modal web dialogs that are posted using the showModalDialog command. You have what some people call a JavaScript dialog or an Alert dialog. (It is in fact a modal dialog, but a different kind of modal.) Frankly, there are a number of what i consider to be hacks that Watir users have used to handle these dialogs. But you'll have to get advice from the people who use them -- not me. Bret Again this is why we need some documentation. People don't know the difference between these different kinds of popups. It would be useful to know specifically when to use the modal dialog versus the enable_popup and Winclicker code. Part of the reason for documentation is that not everything posted in these forums is valid for the up to date versions of Ruby and Watir. And people need to spend a lot of time hunting. Testers aren't going to do that. Developers may. - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=4226messageID=11871#11871 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] watir-1.5.1.1081.gem and popups
. And people need to spend a lot of time hunting. Testers aren't going to do that. Developers may. I'll respectfully suggest that tester or developer, if you don't invest the time to understand what the error messages from Ruby and Watir are telling you, you won't be able to keep up anyway. If you see a need for documentation, please write it. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] watir-1.5.1.1081.gem and popups
[EMAIL PROTECTED] wrote: Again this is why we need some documentation. People don't know the difference between these different kinds of popups. It would be useful to know specifically when to use the modal dialog versus the enable_popup and Winclicker code. Part of the reason for documentation is that not everything posted in these forums is valid for the up to date versions of Ruby and Watir. And people need to spend a lot of time hunting. Testers aren't going to do that. Developers may. I agree. This is why we haven't yet released 1.5 yet. Bret ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] watir-1.5.1.1081.gem and popups
[EMAIL PROTECTED] wrote: Hi I still can't get this to work. If I run the following code, Ruby returns the error message 'Unable to attach to Modal Window nil after 10.5 seconds' Watir::IE::attach_timeout = 10 ie = Watir::IE::new ie.goto(http://www.echoecho.com/javascript4.htm;) ie.button(:name, B1).click_no_wait modal = ie.modal_dialog What am I doing wrong? Thanks This is not the right command for this kind of dialog. The modal_dialog command is for modal web dialogs that are posted using the showModalDialog command. You have what some people call a JavaScript dialog or an Alert dialog. (It is in fact a modal dialog, but a different kind of modal.) Frankly, there are a number of what i consider to be hacks that Watir users have used to handle these dialogs. But you'll have to get advice from the people who use them -- not me. Bret ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] watir-1.5.1.1081.gem and popups
The button "B1" does not open a modal dialog. That is a _javascript_ alert box. For those, you need WinClicker. Lonny Eachus == Subject: Re: [Wtr-general] watir-1.5.1.1081.gem and popups From: [EMAIL PROTECTED] Date: Fri, 15 Sep 2006 21:06:41 -0700 (PDT) Hi I still can't get this to work. If I run the following code, Ruby returns the error message 'Unable to attach to Modal Window nil after 10.5 seconds' Watir::IE::attach_timeout = 10 ie = Watir::IE::new ie.goto("http://www.echoecho.com/_javascript_4.htm") ie.button(:name, "B1").click_no_wait modal = ie.modal_dialog What am I doing wrong? Thanks ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
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 Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] watir-1.5.1.1081.gem and popups
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: wtr-general@rubyforge.org 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 Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] watir-1.5.1.1081.gem and popups
ie.button(:text, Click Me).click_no_wait modal = ie.modal_dialog -Charley On 9/15/06, [EMAIL PROTECTED] [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: wtr-general@rubyforge.org 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 Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] watir-1.5.1.1081.gem and popups
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: wtr-general@rubyforge.org 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 Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] watir-1.5.1.1081.gem and popups
David Schmidt wrote: but I found some special code written by Yaxin Wang which does some fancy C++ casting to give us the same type of handle. David, It seems funny to hear that you found it. This was the code that Yaxin wrote at my request and to my specifications and contributed to Watir for this purpose. We were both with ThoughtWorks at the time. Using Yaxin's code, I wrote the original modal_dialog method that allowed us to access this dialog via Title, and then you enhanced this so that an argument was unnecessary. Bret ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] watir-1.5.1.1081.gem and popups
It's been a while, but I think I found the code in WET or perhaps in someone's blog, but in any case my statement here was to acknowledge that I didn't write that code, and to give credit to the author. David Bret Pettichord wrote: David Schmidt wrote: but I found some special code written by Yaxin Wang which does some fancy C++ casting to give us the same type of handle. David, It seems funny to hear that you found it. This was the code that Yaxin wrote at my request and to my specifications and contributed to Watir for this purpose. We were both with ThoughtWorks at the time. Using Yaxin's code, I wrote the original modal_dialog method that allowed us to access this dialog via Title, and then you enhanced this so that an argument was unnecessary. Bret ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] watir-1.5.1.1081.gem and popups
Hi I still can't get this to work. If I run the following code, Ruby returns the error message 'Unable to attach to Modal Window nil after 10.5 seconds' Watir::IE::attach_timeout = 10 ie = Watir::IE::new ie.goto(http://www.echoecho.com/javascript4.htm;) ie.button(:name, B1).click_no_wait modal = ie.modal_dialog What am I doing wrong? Thanks -Original Message- From: David Schmidt [EMAIL PROTECTED] Sent: Fri, September 15, 2006 15:35 To: wtr-general@rubyforge.org Subject: Re: [Wtr-general] watir-1.5.1.1081.gem and popups It's been a while, but I think I found the code in WET or perhaps in someone's blog, but in any case my statement here was to acknowledge that I didn't write that code, and to give credit to the author. David Bret Pettichord wrote: David Schmidt wrote: but I found some special code written by Yaxin Wang which does some fancy C++ casting to give us the same type of handle. David, It seems funny to hear that you found it. This was the code that Yaxin wrote at my request and to my specifications and contributed to Watir for this purpose. We were both with ThoughtWorks at the time. Using Yaxin's code, I wrote the original modal_dialog method that allowed us to access this dialog via Title, and then you enhanced this so that an argument was unnecessary. Bret ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general