From: Joel Pearson Date: 2012-11-20T20:39:02+09:00 Subject: Re: question on watir Firstly, please start any new question as a new thread so others can find answers more easily in future. Anyways, you want to look into this kind of thing: http://www.tutorialspoint.com/ruby/ruby_exceptions.htm If you're receiving a Timeout exception from Watir but your program keeps running then you're probably handling the exception. What you need to do is terminate when you hit that kind of exception. If you're calling a method and the exception is handled inside that method, you'll need to return a value which will be recognised by the parent and used in a decision as to whether to continue or terminate execution. For example (caveat lector, untested code): ________________________________________________ def mymethod b = Watir::Browser.new b.goto 'www.purple.com' b.close return true rescue Timeout::Error puts "Page load timed out" return false rescue => e puts e return false ensure b.close rescue nil end 10.times do |iteration| unless mymethod puts "Error occurred, terminating process" exit else puts "Succeeded: #{iteration}" end end -- Posted via http://www.ruby-forum.com/.