Ways to handle file uploads in selenium

fileupload

There are situations where we need to automate tasks such as

  • Click on Browse (file explorer pops up)
  • Select required file from explorer window
  • click on open or upload.

“File explorer dialog” and click on “Open” is not browser objects, these are basically windows objects and can not be located using selenium locators.

We have several ways to perform the operation, let’s discuss some of the simple but effective ways to do this task…

  • Using Robot class

  • Using selenium sendKeys and submit

  • Using Autoit setup

Refer our earlier post Autoit with selenium

Whatever the upload controls you have in your application, any one of the above method will definitely work, let me know if any of the above doesn’t work
My personal suggestion is to use 2nd and 3rd method, using Robot class some times doesn’t work.

 

Content posted is based on learning or working experience, Share the post with others if find useful, Any queries?, leave comments or discuss on our facebook:qavalidation.com, Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: