How to Download files in Selenium Webdriver

Hello Welcome to Selenium tutorial, today we will see How to Download files using Selenium Webdriver.

In previous post, we have seen how to upload files using robot class and upload files using AutoIT. Today we will see some different scenario we will see downloading files in Selenium.

Sometime in your application, you have to control some scenario in which you need to download some files by clicking on some link or some button.

Once you start download files/application, you will get one confirmation window, which will ask to save, file or cancel here Webdriver stuck because this is Window’s Pop up. Selenium can handle only Web browser automation not windows based application. Refer below screenshot for more information.

Here download files window is displayed if you try to inspect using firebug you will not get any locators for them.
How to Download files using Selenium

So using some browser settings (firefoxprofile) we can skip that confirmation window and we can continue with our script.

Here is some setting that we need to modify let’s see how to check these setting

How to Download files in Selenium Webdriver

1- Open Firefox browser and in url box type about:config and press enter

2- In Search bar type neverask and enter, here you will find some settings(refer below screenshot)
How to Download files using Selenium

Now you can see here value is blank so we need to mention which type of file it will not ask if download starts in case.

Note- In this post I am giving values for .exe file(application), in your case if you want to download pdf, excel file etc. you need to mention values (MIME type).

Here you can find their MIME type that will be the values for these settings.

How to Download files in Selenium Webdriver

Step 1- Create a firefox Profile.

Step 2- set Preferences as per requirement.

Step 3- Open Firefox with firefox profile.

Let us implement the same through Script.

Note- This script will download Adobe Reader from

package blog;


If you run above code files will be download automatically and download window will not appear 🙂

Please comment below if you have any issue in Selenium. Thanks for visiting my blog keep in touch.




  1. manoj kumar sahoo
  2. Sowmyashree R
    • Sowmyashree R
      • Sowmyashree R
  3. sonali
  4. Tarun
  5. suresh
  6. shilpa
  7. Sreenath
  8. Priyanka Chouhan