[Wtr-general] How to handle a timeout when allert window notf ound?
Paatsch, Bernd
BPaatsch at activevoice.com
Wed Feb 1 18:32:43 EST 2006
I found the answer
reguire 'timeout'
begin
.....
...
rescue TimeoutError # this does not work on my machineTimeout::Error
puts "No alert window found"
end
Bernd
_____
From: wtr-general-bounces at rubyforge.org
[mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Paatsch, Bernd
Sent: Wednesday, February 01, 2006 3:18 PM
To: 'wtr-general at rubyforge.org'
Subject: Re: [Wtr-general] How to handle a timeout when allert window
notfound?
I get following error:
./wacSubAddRangeSubscriber.rb:128:in `addRangeSubscriber': uninitialized
constant WebAC::TIMEOUT (NameError) from
C:/watir-v1_4/examples/WAC/wacTestCollection.rb:51
_____
From: wtr-general-bounces at rubyforge.org
[mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Paatsch, Bernd
Sent: Wednesday, February 01, 2006 2:58 PM
To: 'wtr-general at rubyforge.org'
Subject: [Wtr-general] How to handle a timeout when allert window not found?
Hi Rague,
I refere to a thread Nov 22. Within this thread your recommended following
code:
We ran into a similar issue a while back. For some reason
(I dont know if it is a ruby issue), rescue doesn't trap 'Timeout' errors.
You have explicitly catch a Timeout error as:
begin
.....
...
rescue Timeout::Error
puts "No alert window found"
end
Raghu
I tried it and it does not work. Do I have to include any special module?
I have this nasty and popup to deal with however when there is no popup
window it does not go into rescue.
begin
puts "begin"
br=nil
br = Browser("url:=/add.php/")
br.Dialog("title:=Microsoft Internet Explorer")
#dublicate_win = br.Dialog("title:=Microsoft Internet
Explorer").Label("index:=2")
dublicate_win = br.Dialog("title:=Microsoft Internet
Explorer").Label("text:=/DUPLICATE/")
puts dublicate_win
rescue TIMEOUT::ERROR
# great we don't have dublicate extension
puts "rescue"
$logger.log( " Action: no popup window with dublicated extension
found.")
ensure
text = dublicate_win.display_text
# wwe have to deal with the popup window dublicate extension
$logger.log( " Action: found popup window " + text)
br.Dialog("title:=Microsoft Internet
Explorer").Button("text:=OK").click
sleep(1.5)
dublicate_win = nil
end
Thanks,
Bernd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060201/8117c661/attachment.html
More information about the Wtr-general
mailing list