Download files in Chrome browser using selenium WebDriver


There are situations where we need to

  • Download files from browser,
  • Save in a specified folder on hard disk.

We will be taking help of ChromePreferences, ChromeOptions and DesiredCapabilities of Chrome in selenium.

Find below code to download files in Chrome browser:

Find the downloaded file under the specified folder – c:\download

Content posted is based on learning or working experience, please leave comments if anything needs to be added or updated, discuss your queries on our, Thanks!

3 Responses

  1. Hussain says:

    By using Robot class, we can achieve this easily…

    if Save Button is Highlighting in Download popup:
    Robot r=new Robot();

  2. NAMBIAR says:

    Hello, I tried exactly the same solution and it’s showing me the Save window. Then I sued the Robot key event and it’s downloading to the user default download folder and NOT to the custom download directory.

Leave a Reply

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

%d bloggers like this: