R
Rutger Geelen
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.
My code looks exactly like described there:
# A Better Popup Handler using the latest Watir version. Posted by
(e-mail address removed)
#
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
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.
My code looks exactly like described there:
# A Better Popup Handler using the latest Watir version. Posted by
(e-mail address removed)
#
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