How can we handle Upload File component using Selenium IDE? How can we handle Upload File component using Selenium IDE? selenium selenium

How can we handle Upload File component using Selenium IDE?


A command like this works for me on Selenium IDE 2.5.0

Command: typeTarget:  id=idOfFileInputValue:   /full/path/to/uploadfile

Now I'm trying to find out how to pass a relative path from the Selenium script :-)


The general rule of the thumb is that you don't need to automate any "native dialogs" that are part of the web browser itself. What you do instead is recreate the same general function of the HTTP POST using Apache HTTP Utils. So, if the upload button has a URL that it posts the file upload to, all you do is recreate in code the file upload activity and skip using the native "browse for file" dialog and the "submit" button on that dialog. Instead, just manually post the file using code.

I think that is how most Selenium developers do it. In the future, there will be a WebDriver upgrade that adds control over native browser components and they are still working on it. It is called Marionette and the Mozilla foundation is working on it.