How to download an Excel file from the web using Selenium? I tried using firefoxprofile.setpreference
, but it's not working to me.
Here is my code:
FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.setPreference("browser.download.folderList",2);
firefoxProfile.setPreference("browser.download.manager.showWhenStarting",false);
firefoxProfile.setPreference("browser.download.dir",downloadPath);
firefoxProfile.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");
driver firefoxdriver=new firefoxdriver(firefoxProfile)
I am using Windows 7 and Firefox 39.0.
Still during execution Firefox opens a window to ask if I want to save or open the file, with open selected by default.
Is there a solution for this issue?