Download files using WebDriver
File downloads need to be managed at the time of driver instance creation.FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("browser.download.folderList",2);
profile.setPreference("browser.download.manager.showWhenStarting",false);
profile.setPreference("browser.download.dir", "C:\\Users\\123\\Downloads");
profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/octet-stream");
driver = new FirefoxDriver(binary, profile);