you might also try setting focus to the filename field , and then using autoit
to set the filename.
Zeljko, this works for me and it is much faster because it uses the handle of
the object.
require 'watir/contrib/enabled_popup'
$path = "C\:\\watir_bonus\\working\\MyDoc.txt"
def startClicker( button , waitTime=5, 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
# this is whatever invokes the file field dialog
adoc = $ie.frame("main").image(:src,
"https://alinea.inmar.com/alinea/images/adddocument.gif")
adoc.click_no_wait
# call the clicker
startClicker( '&Open', 9, $path)
--Mark
________________________________
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Željko Filipin
Sent: Monday, November 27, 2006 2:57 AM
To: Watir
Subject: [Wtr-general] Is there a way to make file_field.set faster?
Is there a way to make file_field.set faster?
I have noticed that this is the slowest part of my tests. It takes about 10
seconds to set file field. I have read that it can not be set directly because
that would be security issue, but I wonder what I could do to make it faster. I
upload extremely small files (a few bytes), but I have to do it frequently, and
every time it takes about 10 seconds just to set file field.
Any help would be appreciated.
Thanks.
--
Zeljko Filipin
zeljkofilipin.com
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general