Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (19.7k points)

I have to perform following task using Selenium Webdriver given below.

  1. Click on any link/button that starts downloading any file (filetype may be anything image, pdf, jar, etc)
  2. Click on the "Save" on popup if appeared (e.g. in case of
  3. Give the desired location to save that file.

Can anyone share, how can we implement this using Java?

1 Answer

0 votes
by (62.9k points)

You can set Firefox browser's preference to save a file automatically, and not let the download window popup. Then you will be able to just grab the file, and it'll start getting downloaded.

So, something like this:

FirefoxProfile fxProfile = new FirefoxProfile();







WebDriver driver = new FirefoxDriver(fxProfile);


and given that you now have the download directory, it will not ask you to save the file, and no download manager would appear, as automation from this point would be straightforward.

I hope this helps!

Browse Categories