5

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

Jeroen Kransen
  • 1,379
  • 3
  • 19
  • 45
Karunagara Pandi
  • 634
  • 7
  • 16
  • 27

2 Answers2

5

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 :-)

Jeroen Kransen
  • 1,379
  • 3
  • 19
  • 45
  • Hi Jeroen Kransen, I tried by uploading a file using YUI Flash Upload Component with the Selenium IDE 2.5.0. But it doesn't work while executing the recorded script. :( – Karunagara Pandi Feb 24 '14 at 06:16
  • Relative path: http://stackoverflow.com/questions/33986074/selenium-ide-path-of-file-to-be-uploaded-is-to-be-made-relative/36706397#36706397 – Lee Kowalkowski Apr 19 '16 at 06:24
  • This doesn't seem to work by the method you guys have listed here. This command only changes the elements HTML value to the file.path and not the DOM's value to the file.path which needs to be done. Are you really successful with this method? – GIZNAJ Jun 19 '17 at 14:26
1

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.

djangofan
  • 28,471
  • 61
  • 196
  • 289
  • Which means, uploading a file through YUI Flash Upload Component, selenium developers and Mozilla foundation people are working. isn't? – Karunagara Pandi Feb 24 '14 at 06:16
  • Marionette still might not be able to automate a flash object. You still might need to use one of the tools listed here: http://altom.ro/blog/flexflash-test-automation-tools-2 – djangofan Feb 24 '14 at 16:00