How to download any file and save it to the desired location using Selenium Webdriver

You won’t be able to access the save dialog box. That’s controlled by the OS. The only thing you’re really going to be able to do is set the default download location for the browser and allow it to automatically download the files. Then check the file in Java.

You should check this answer from this previous SO question. Basically when setting up your Firefox profile you add a call to set the property browser.helperApps.neverAsk.saveToDisk to a comma separated list of MIME types to always download:

firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk","text/csv");

See this Mozilla KB FAQ article on About:configs.

UPDATE
It looks like this may now be possible see this answer in another question

Leave a Comment