Can anyone please provide idea or site reference for handling File Upload Process using Selenium IDE?
Rest of the actions are recording thru' Selenium IDE but this upload process is alone giving trouble...
Thanks Karunagara Pandi
We can upload files using Selenium Webdriver. This is achieved by the sendKeys method. We have to first identify the element which performs the file selection by mentioning the file path [to be uploaded].
From the menu bar, select File > Import Selenium IDE Project and browse your Selenium IDE file (a single file with a . side extension) to open.
A command like this works for me on Selenium IDE 2.5.0
Command: type
Target: id=idOfFileInput
Value: /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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With