Yeah, that blocking behavior is a common problem. It seems at the
moment the easiest way to get around that is to execute the code to
handle the popup in a separate process.
To experiment with this you can put the popup handling code in its own
script, verify that it works as expected when run on its own, then
(for example of the popup-handling script name is "foo.rb") use
system("start foo.rb") (or "start rubyw foo.rb", if you prefer) to
start that script just before the line of code in your Watir script
that causes the popup to appear.
It's not the only way to solve the problem, but it usually works. :)
On Thu, Feb 12, 2009 at 2:28 PM, Jason Shelton <[email protected]> wrote:
> Thanks, autoit is definitely something I will begin to utilize. My issue
> now is that script that causes the popup to prompted, stops whenever the
> popup is prompted, so the code after if(the autoit code) is not executed
> until the popup is canceled. I can elaborate if necessary. Thanks in
> advance.
>
> - Shelton
>
>> Date: Thu, 12 Feb 2009 13:44:24 -0800
>> Subject: [wtr-general] Re: Verify text on a popup
>> From: [email protected]
>> To: [email protected]
>>
>>
>> The AutoIt function name "WinGetText" should be a good keyword to
>> google to see some useful example code. Here's a Watir list thread
>> from earlier this year about it:
>>
>>
>> http://groups.google.com/group/watir-general/browse_thread/thread/5b6f529b16616bbc?pli=1
>>
>> And a Watir wiki page that shows a little autoit code:
>>
>> http://wiki.openqa.org/display/WTR/File+Downloads
>>
>> As shown there, the usual pattern when working with AutoIt from Ruby
>> is to create an AutoIt object, and use it to invoke the various AutoIt
>> functions. Pretty painless. :) For example, to get the contents of
>> the main window in a notepad.exe instance whose title is "Untitled -
>> Notepad":
>>
>> autoit = WIN32OLE.new("AutoItX3.Control")
>> text = autoit.WinGetText("Untitled - Notepad", "")
>>
>> I suggest playing around with the AutoIt functions in irb, that's the
>> fastest way to get things working.
>>
>> The documentation for the avaliable functions is here:
>> http://www.autoitscript.com/autoit3/docs/
>>
>> As a side note, I think there may be an autoit object instantiated
>> when you create an IE object with Watir, but I don't know if it's
>> meant to be directly accessible. So the safest thing may be to create
>> your own as shown in the snippets above.
>>
>> Bill
>>
>>
>> On Thu, Feb 12, 2009 at 1:29 PM, Jason Shelton <[email protected]>
>> wrote:
>> > I have searched through the archives, but have not been able to find any
>> > examples of what I am looking for. I have never used autoit, so are
>> > there
>> > any ways to do this without it? I am willing to learn it if necessary.
>> > Thanks in advance.
>> >
>> > - Shelton
>> >
>> >> Date: Thu, 12 Feb 2009 12:54:20 -0800
>> >> Subject: [wtr-general] Re: Verify text on a popup
>> >> From: [email protected]
>> >> To: [email protected]
>> >>
>> >>
>> >> Hi,
>> >>
>> >> There should be some examples of how to do this in the list archives.
>> >> There are several different ways to get the text of a dialog, but the
>> >> easiest thing to do is probably to use autoit. Please reply back if
>> >> you have questions about it.
>> >>
>> >> Bill
>> >>
>> >>
>> >> On Thu, Feb 12, 2009 at 12:24 PM, Jason Shelton
>> >> <[email protected]>
>> >> wrote:
>> >> > All,
>> >> >
>> >> > I have read the tutorial about killing a 'Windows Internet Explorer'
>> >> > javascript popup, but I am writing to ask if there is a way to verify
>> >> > the
>> >> > text on these popups first, with a method similar to .contains_text?
>> >> > If
>> >> > this question is not clear, I can elaborate. Thanks in advance.
>> >> >
>> >> > - Shelton
>> >> >
>> >> > ________________________________
>> >> > Windows Liveā¢: Keep your life in sync. See how it works.
>> >> > >
>> >> >
>> >>
>> >> >
>> >
>>
>> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Watir General" group.
To post to this group, send email to [email protected]
Before posting, please read the following guidelines:
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---