[Wtr-general] How to handle a timeout when allert window not found?

Paatsch, Bernd BPaatsch at activevoice.com
Wed Feb 1 17:58:00 EST 2006


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/0e31d546/attachment.html 


More information about the Wtr-general mailing list