# watir::exception::Timeoutexception

**URL:** <https://www.ruby-forum.com/t/watir-timeoutexception/131024>\
**Category:** Ruby\
**Created:** [March 5, 2008, 10:33am UTC](https://www.ruby-forum.com/t/watir-timeoutexception/131024 "2008-03-05T10:33:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rutger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/8edcca/32.png) [@rutger](https://www.ruby-forum.com/u/rutger)\
**Post date:** [March 5, 2008, 10:33am UTC](https://www.ruby-forum.com/t/watir-timeoutexception/131024/1 "2008-03-05T10:33:02Z")

</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

removed\_email\_address@domain.invalid

# 

require ‘watir\contrib\enabled\_popup’

# 

def startClicker( button , waitTime= 9, user\_input=nil )

# get a handle if one exists

hwnd = $ie.enabled\_popup(waitTime)  
if (hwnd) # yes there is a popup  
w = WinClicker.new  
if ( user\_input )  
w.setTextValueForFileNameField( hwnd, “#{user\_input}” )  
end  
# I put this in to see the text being input it is not necessary to  
work  
sleep 3  
# “OK” or whatever the name on the button is  
w.clickWindowsButton\_hwnd( hwnd, “#{button}” )  
#  
# this is just cleanup  
w=nil  
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
