I'm new to Watir as well as Ruby, and I need help handling a pop-up dialog.
I've searched both the mailing list as well as the trying all that I've
found, but I couldn't get it to click on the "OK" pop-up button.
==============================================================
require 'watir'
require 'watir\enabled_popup'
#require 'watir/WinClicker'
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
switch_role.role.select("my role")
startClicker( "OK", 3, "")
==============================================================
when I tried code block above, I get this error message:
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require': no such file to load -- watir\contrib\enabled_popup
(LoadError)
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
from CMSlogin.rb:2
when I try this code block:
require 'watir/WinClicker'
def sstartClicker( button , waitTime = 3)
w = WinClicker.new
longName = $ie.dir.gsub("/" , "\\" )
shortName = w.getShortFileName(longName)
c = "start ruby #{shortName }\\watir\\clickJSDialog.rb #{button } #{
waitTime} "
puts "Starting #{c}"
w.winsystem(c)
w=nil
end
switch_role.role.select("my role")
startClicker( "OK", 3)
This just waits forever and does not click on the OK button.
==============================================================
Can someone please help?
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general