You could try something like—you will need to tweak it to work for your application:

 

    $path = "C\:\\watir_bonus\\working\\Approach.doc"

    $ie.frame(:index, 5).file_field(:id, "fileName").set("#{$path}")

   

    $autoit = WIN32OLE.new("AutoItX3.Control")

    $autoit.WinWait("Choose file", "Do you want to open or save this file?", 3)

    $autoit.WinActivate("Choose file")

    $autoit.WinWait("Choose file", "Look &in", 3)

    $autoit.ControlSetText("Choose file", "", "Edit1", "#{$path}")

    $autoit.ControlClick("Choose file", "Look &in", "&Open")

   

    $ie.frame(:index, 5).button(:name, "submitLinkManagerForm").click

 

 

--Mark

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Amitha Shetty
Sent: Sunday, January 01, 2006 9:56 PM
To: [email protected]
Subject: [Wtr-general] How can I open and attach file using file_fieldmethod?

 

Hi,

How can I open and attach file using file_field method?

when I try,

ie.file_field(:id,'uploaded_file').set('C:\file.txt')

I get "choose file"-window open .It waits for me, to choose a file and 
click "open" or whatever the button is called) , after that it 
continues normally, by submitting the file_field content. Why doesn't he choose a file by himself?How do I handle this?

I have ensured that there is no space in the path and the file exists in C: )
I get the same error when I run filefield_test in Unittests in watir folder.

 

Thanks,

Amitha

 

Send instant messages to your online friends http://in.messenger.yahoo.com

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to