PDA

View Full Version : Interact with file dialog box opened in webpage



sig331
12-27-2012, 02:06 PM
Hi, I am trying to automate a file upload. Unfortunately the only way I can upload the file is through a https page and directly through FTP.

I am hung up on passing the path to the file upload dialog box. Right now, I "click" the upload button and the dialog opens, but I cannot figure out how to get the path to populate. SendKeys is really all I have tried. Is there an object to work with a file dialog generated in IE? Or some other method that would work? Here's the relevant code snippet.


With ieapp
'click the upload button
.Document.All("File").Click
'pause for good measure
Application.Wait DateAdd("s", 2, Now)
'pass file path
SendKeys "THE PATH TO FILE"
End With


The little bit of HTML:



<INPUT TYPE=FILE NAME="File" SIZE=20>&nbsp;&nbsp;
<INPUT VALUE="Upload File" TYPE=SUBMIT >


Thanks