In a series of applications my team is building we would like to test our import and export functionality, which requires the respective upload and download to be automated.

Export functionality is simple, but tied to the UI:

  1. the end-user needs to be able to click on a button on the web UI
  2. then the resultant export file is downloaded.

With import uploads, the idea is:

  1. to have a local file relevant to the application
  2. then use the web UI to upload this file
  3. then test the import functionality.

Ideally I'm looking for the ability to do this via Selenium IDE, but as I understand it, that is not possible.

Can this be done via Selenium WebDriver (via C#)?

If not, what is the best strategy to test this functionality? I'd like to test this as the end user and not simply pointing to some back-end URL to perform these tests.

2 Answers 2

  1. The way to do it with Firefox browser

    • File download:

      FirefoxProfile profile = new FirefoxProfile();
      profile.SetPreference("browser.download.dir", @"c:\path\to\downloads\folder");   
      FirefoxDriver driver = new FirefoxDriver(profile);

    change MIME/TYPE to be correct MIME type of the file(s) you're uploading, for instance: application/pdf for PDF files, application/vnd.openxmlformats-officedocument.wordprocessingml.template for MS Word 2007+ .docx files, etc.

    • File upload: it is quite enough to provide full path of the file you need to upload to SendKeys method

      IWebElement element = FindElement(By.Locator.of.your.file.type.input);
  2. The other way to simulate files upload/download is using Apache JMeter tool, it is free, open source and designed for load testing so you will not only be able to test functionality, but also assess performance.

    • File Download: it is enough to add Save Responses to a file Post Processor to save response data to specified location

      Save Responses to file

    • File Upload: use "Send Files with the Request" field of the HTTP Request sampler as per image below:

      HTTP Request for file upload

    See Performance testing: Upload and Download Scenarios with Apache JMeter for more detailed instructions on how to conduct your use case with JMeter


It is possible to upload the files using selenium IDE. It can be done as mentioned below.





You can identify the "target_location_path" by manually uploading the file and then finding the xpath of the uploaded file in the web app.

Please refer below screenshot to get a better understanding.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.