[Wtr-general] Is there a way to make file_field.set faster?

Cain, Mark Mark_Cain at RL.gov
Mon Nov 27 10:26:13 EST 2006


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: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] 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 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20061127/137809cb/attachment.html 


More information about the Wtr-general mailing list