tags:

views:

46

answers:

2

I've hit a snag. I am trying to use WatiN to upload a file. I can load the upload box, but it quickly disappears. The last line of my code at the moment is:

ie.FileUpload(Find.ById("profile_file")).Click();

It loads the dialog to select a picture but disappears. Is it possible to set the path of the box automatically example, load "C:/Desktop/image.jpg"?

Also, is it possible to wait for the upload to complete before continuing?

Help is much appreciated.

Thanks.

A: 

While this won't answer your question directly, I suspect there is a DialogWatcher automatically canceling the dialog.

Ian P
I've managed to use the Set() method of FileUpload() but as it's uploading the image it will close the box and cause an 'Unspecified Error'.The actual uploading works, because I can see it saying 'Uploading Image'.Strange one here.
James Jeffery
Sorry, the image actually uploads. But it returns an error.
James Jeffery
A: 

why do you need to select from the Dialog.. Try to just sent the Text:

ie.FileUpload(Find.ById("profile_file")).Text = "C:/Desktop/image.jpg";
Shady M. Najib
Shady M. Najib