It won't break out of the loop until you tell it to. Think you just need to add
a check to see if ControlClick has done the job (or whatever the last critical
thing is). If you're getting something like true/false you could probably do
something like this:
break if autoit.ControlClick("Message from webpage",'WARNING! ', 'OK')
________________________________
From: Knight026 <[email protected]>
To: Watir General <[email protected]>
Sent: Monday, November 14, 2011 7:00 PM
Subject: [wtr-general] Ruby script will not terminate
I recently added this code to my script and it clicks ok on the popup.
That's awesome, but now the script will not terminate. I just began
learning Ruby about a week ago and it seems like there is something
simple that's preventing the script from ending, but I'm not sure what
it is. I copied the code from
http://wiki.openqa.org/display/WTR/JavaScript+Pop+Ups.
begin
autoit = WIN32OLE.new('AutoItX3.Control')
loop do
#autoit.ControlClick("TITLE",'', 'BUTTON TEXT')
#autoit.ControlClick("Security Information",'', '&Yes')
#autoit.ControlClick("Security Alert",'', '&Yes')
#autoit.ControlClick("Security Warning",'', 'Yes')
autoit.ControlClick("Message from webpage",'WARNING! ', 'OK')
# other options can be included here
sleep 1
end
rescue Exception => e
puts e
end
--
Before posting, please read http://watir.com/support. In short: search before
you ask, be nice.
[email protected]
http://groups.google.com/group/watir-general
[email protected]
--
Before posting, please read http://watir.com/support. In short: search before
you ask, be nice.
[email protected]
http://groups.google.com/group/watir-general
[email protected]