Title: How to handle a timeout when allert window not found?
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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paatsch, Bernd
Sent: Wednesday, February 01, 2006 3:18 PM
To: '[email protected]'
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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paatsch, Bernd
Sent: Wednesday, February 01, 2006 2:58 PM
To: '[email protected]'
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

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

Reply via email to