Try something like this using file_field instead of text_field:

 

    $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 [EMAIL PROTECTED]
Sent: Thursday, December 15, 2005 11:30 AM
To: [email protected]
Subject: [Wtr-general] How to manipulate attaching files

 

I may have posted twice. Looks like the first one did not make it through.

 

I have web application that requires attaching a file very similar to attaching a file in Yahoo mail. Rather than manipulating the attach button, navigating to the file and attaching it, I thought I would use a short cut by writing directly into the text field the path to the file. However, using this approach returns an UnknownObjectException.

 

To illustrate, I'm using the text field method

 

ie.text_field(:name, "typeinme").set("some text")

 

<input type = "text" name = "typeinme" >

 

However, in my html reads like this:

 

<input type = "file" name = "typeinme" >

 

Does anybody have any ideas how to solve this problem?

 

 

 

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

Reply via email to