# watir::exception::Timeoutexception

**URL:** <https://rubytalk.org/t/watir-exception-timeoutexception/44984>\
**Category:** ruby-talk\
**Created:** [5 March 2008 09:32 UTC](https://rubytalk.org/t/watir-exception-timeoutexception/44984 "2008-03-05T09:32:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rutger\_Geelen](https://avatars.discourse-cdn.com/v4/letter/r/7993a0/32.png) [@Rutger\_Geelen](https://rubytalk.org/u/Rutger_Geelen)\
**Post date:** [5 March 2008 09:32 UTC](https://rubytalk.org/t/watir-exception-timeoutexception/44984/1 "2008-03-05T09:32:54Z")

</div>

Hi,  
I'm using Watir to do some tests. Depending on the outcome of a test a  
java pop appears which I can click using the third method as described  
on [http://wiki.openqa.org/display/WTR/JavaScript+Pop+Ups](http://wiki.openqa.org/display/WTR/JavaScript+Pop+Ups).

My code looks exactly like described there:

# A Better Popup Handler using the latest Watir version. Posted by  
[Mark\_cain@rl.gov](mailto:Mark_cain@rl.gov)

> **···**
>
> #  
> require 'watir\contrib\enabled\_popup'  
> #  
> def startClicker( button , waitTime= 9, user\_input=nil )  
> &nbsp;&nbsp;# get a handle if one exists  
> &nbsp;&nbsp;hwnd = $ie.enabled\_popup(waitTime)  
> &nbsp;&nbsp;if (hwnd) # yes there is a popup  
> &nbsp;&nbsp;&nbsp;&nbsp;w = WinClicker.new  
> &nbsp;&nbsp;&nbsp;&nbsp;if ( user\_input )  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;w.setTextValueForFileNameField( hwnd, "#{user\_input}" )  
> &nbsp;&nbsp;&nbsp;&nbsp;end  
> &nbsp;&nbsp;&nbsp;&nbsp;# I put this in to see the text being input it is not necessary to  
> work  
> &nbsp;&nbsp;&nbsp;&nbsp;sleep 3  
> &nbsp;&nbsp;&nbsp;&nbsp;# "OK" or whatever the name on the button is  
> &nbsp;&nbsp;&nbsp;&nbsp;w.clickWindowsButton\_hwnd( hwnd, "#{button}" )  
> &nbsp;&nbsp;&nbsp;&nbsp;#  
> &nbsp;&nbsp;&nbsp;&nbsp;# this is just cleanup  
> &nbsp;&nbsp;&nbsp;&nbsp;w=nil  
> &nbsp;&nbsp;end  
> end  
> #  
> # MAIN APPLICATION CODE  
> #  
> $ie = Watir::IE.start( "my\_URL" )
> 
> # This is whatever object that uses the click method.  
> # You MUST use the click\_no\_wait method.  
> $ie.image( :id, '3' ).click\_no\_wait  
> #  
> # 3rd parameter is optional and is used for input and file dialog boxes.  
> startClicker( "OK ", 7 , "User Input" )  
> #  
> # Main application code follows  
> # ...
> 
> Now my problem is this: if a pop-up pops up everything runs fine but if  
> a pop up does not appear (there is no warning) my script stops and I get  
> the message  
> C:/IR20/ruby/lib/ruby/gems/1.8/gems/watir-1.5.3/./watir/waiter.rb:55:in  
> `wait\_un  
> til': Timed out after 7.469 seconds.  
> (Watir::Exception::TimeOutException).
> 
> Some how I can't get the method to be ingnored if no java pop up appears  
> and therfore the time out kicks in. Anybody any ideas?
> 
> Cheers,
> 
> Rutger  
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
