Use the robot class for downloading files.Through this class you can pass the keyboard keys like "Up","Down","Enter".It is mentioned in Module 15 last video.
for excel file this works
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("browser.download.folderList", 2);
profile.setPreference("browser.download.manager.showWhenStarting", false);
profile.setPreference("browser.download.dir", "C:\\temp");
//profile.setPreference("browser.helperApps.neverAsk.openFile",
//"text/csv,application/x-msexcel,application/excel,application/x-excel,application/vnd.ms-excel,image/png,image/jpeg,text/html,text/plain,application/msword,application/xml,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet ");
profile.setPreference("browser.helperApps.neverAsk.saveToDisk",
"text/csv,application/x-msexcel,application/excel,application/x-excel,application/vnd.ms-excel,image/png,image/jpeg,text/html,text/plain,application/msword,application/xml,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet ");
profile.setPreference("browser.helperApps.alwaysAsk.force", false);
profile.setPreference("browser.download.manager.alertOnEXEOpen", false);
profile.setPreference("browser.download.manager.focusWhenStarting", false);
profile.setPreference("browser.download.manager.useWindow", false);
profile.setPreference("browser.download.manager.showAlertOnComplete", false);
profile.setPreference("browser.download.manager.closeWhenDone", true);
WebDriver driver = new FirefoxDriver(profile);
driver.get("http://qtpselenium.com/test/testdownload.php");
driver.findElement(By.xpath("html/body/a[1]")).click();
Hi Thanks for your reply.
The FF and Chrome are fine to set profiles, but IE there isn't any.
Please check IE 11 when we download a file it is giving the alert/popup in the footer of the page and I couldn't fine any Robot class in C# selenium. Please advice how to handle this. I have seen your video which is showing the popup in the middle as an alert and there is a class in Java as Robot but there are none in C#..
Thanks
i'm not that good at C#.
this link will help you on ie file download
http://sqa.stackexchange.com/questions/3169/downloading-a-file-in-internet-explorer-through-selenium
http://ardesco.lazerycode.com/index.php/2012/07/how-to-download-files-with-selenium-and-why-you-shouldnt/
That did not help, could you at least tell me how to handle IE 11 save pop up when we try to download any file. I just need to click on save button to download in the default location. I have tried Autoit where I can spy pop up buttons in chrome but not in IE, pls help...
for java you use robot framework but for c# there are no classes like "robot"
Ok thanks
Can we do it with AUTOIT tool to click on Save button on the IE 11 download, is anyone tried ?