How to download .xlsx when file build at browser end provide options for download

24 views
Skip to first unread message

Pavan Tuptewar

unread,
Feb 23, 2016, 6:29:53 AM2/23/16
to webdriver
I wanted to save downloaded file at selected location but it is not working as I analysed functionality of download I have found that response type Application/json and after words it is converted into .xlsx file and provide for download for the same I have implemented following code but it is not working as it also not showing any error or exception 




//FirefoxProfile profile
 
public static  FirefoxProfile setProfile() throws Exception {
 
 profile
=new FirefoxProfile();
 
 profile
.setPreference("browser.download.folderList", 2);
 profile
.setPreference("browser.download.dir",downloadPath);
 profile
.setPreference("browser.download.manager.showWhenStarting", false);
 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/xlsx,application/json");
 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/xlsx,application/json");
 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", false);
 
 
return profile;
 
}

Mark Collin

unread,
Feb 24, 2016, 3:16:11 AM2/24/16
to webdriver
Reply all
Reply to author
Forward
0 new messages