public static FirefoxProfile FirefoxDriverProfile() {
String mimeTypes = "application/pdf,application/vnd.adobe.xfdf,application/vnd.fdf,application/vnd.adobe.xdp+xml,text/rtf,application/octet-stream,text/csv,application/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.spreadsheetml.sheet,application/octet-stream,multipart/x-zip,application/zip,application/zip-compressed,application/x-zip-compressed";
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("browser.download.folderList", 2);
profile.setPreference("browser.download.manager.showWhenStarting", false);
profile.setPreference("browser.download.dir", Driver.defaultDownloadDirectoryPath.getAbsolutePath());
profile.setPreference("browser.helperApps.neverAsk.openFile", mimeTypes);
profile.setPreference("browser.helperApps.neverAsk.saveToDisk", mimeTypes);
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);
profile.setPreference("plugin.disable_full_page_plugin_for_types", "application/pdf,application/vnd.adobe.xfdf,application/vnd.fdf,application/vnd.adobe.xdp+xml");
profile.setPreference("browser.download.useToolkitUI", true);
profile.setPreference("reader.parse-on-load.enabled", false);
profile.setPreference("gecko.handlerService.schemes.txt.0.name", "TextPa");
// Set this to true to disable the pdf opening
profile.setPreference("pdfjs.disabled", true);
return profile;
}
Patrick Albaret
I would suggest a read of this:
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/0ddf5029-29cf-4839-a410-7beb7dc8afed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.