Hello Malar,
Here is an example of what works for me. I've added '.flash' to the
button clicks make it easy follow.
As infoDrone mentioned, click_no_wait must be used on the button that
precedes the popup.
You may need to adjust 'waitTime = 30'. It takes a while for the popup
to appear - just be patient
I'm using the same environment as yours - Ruby-186.26 and
Watir-1.6.2
Can someone comment on why it takes the popup so long to appear?
###################################
require 'watir/ie'
require 'win32ole'
require 'watir\contrib\enabled_popup'
def jsClick( a, button, user_input=nil)
waitTime=30
hwnd = $ie.enabled_popup(waitTime)
if (hwnd)
w = WinClicker.new
if ( user_input )
puts("if = user input")
w.setTextValueForFileNameField(hwnd, "#{user_input}")
end
sleep 3
w.clickWindowsButton_hwnd(hwnd, "#{button}")
w=nil
end
end
test_site = "
http://www.google.com"
$ie = Watir::IE.new
$ie.goto test_site
$ie.maximize()
$ie.link(:text, 'Preferences').flash
$ie.link(:text, 'Preferences').click
$ie.radio(:id,"slc").flash
$ie.radio(:id,"slc").set
$ie.button(:name,"submit2").focus
$ie.button(:name,"submit2").flash
$ie.button(:name,"submit2").click_no_wait
jsClick( $ie, "OK")
sleep 5
$ie.close
###################################
Darryl (gem dandy) Brown