This works for putting text into an JS promt(input) box:
require 'watir\contrib\enabled_popup'
def startClicker( button , waitTime=9, user_input=nil)
hwnd = $ie.enabled_popup(waitTime) # get a handle if one exists
if (hwnd) # yes there is a popup
w = WinClicker.new
if ( user_input )
w.setTextValueForFileNameField(hwnd, "#{user_input}")
end
sleep 3 # I put this in to see the text being input it is not
necessary to work
w.clickWindowsButton_hwnd(hwnd, "#{button}") # "OK" or whatever
the name on the button is
w=nil # this is just cleanup
end
end
$ie=Watir::IE.start("c:\test.htm")
$ie.image(:id,'3').click_no_wait
startClicker("OK", 7, "User Input")
Hope this helps,
--Mark
________________________________
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of VIKASH KUMAR
Sent: Thursday, November 16, 2006 2:12 AM
To: [email protected]
Subject: [Wtr-general] problem in entering values in javascript input
box
I am clicking on an image using
require 'watir'
include Watir
ie=Watir::IE.start("c:\test.htm")
ie.image(:id,'3').click
When the image is clicked it opens a javascript input box asking to
enter some value, and click on either OK or Cancel button.
I am unable to enter value in it also not able to click on either of the
button, this stops my code, I have to enter value in the input box
manually then click on either of the button.
Please help me how to enter value in the javascript input box and then
click on either of the button.
Thanks
________________________________
Find out what India is talking about on - Yahoo! Answers India
<http://us.rd.yahoo.com/mail/in/yanswers/*http:/in.answers.yahoo.com/>
Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8.
Get it NOW
<http://us.rd.yahoo.com/mail/in/messengertagline/*http:/in.messenger.yah
oo.com>
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general