Code was used that will always download PDF. Since then, he began to open PDF inside the browser. The same thing happens for chrome and firefox.
In chrome, I already tried:
DesiredCapabilities capabilities = DesiredCapabilities.chrome(); capabilities.setCapability("chrome.switches", Arrays.asList("--disable-extensions")); driver = new ChromeDriver(capabilities);
And in firefox I tried:
FirefoxProfile firefoxProfile = new FirefoxProfile(); firefoxProfile.setPreference("browser.download.folderList", 2); firefoxProfile.setPreference("browser.download.manager.showWhenStarting", false); firefoxProfile.setPreference("browser. download. manager. useWindow",true); firefoxProfile.setPreference("plugin.disable_full_page_plugin_for_types", "application/pdf"); firefoxProfile.setPreference("browser.download.dir","C:\\Documents and Settings\\xxxx\\My Documents\\Downloads"); firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk","application/pdf;text/plain;text/csv"); firefoxProfile.setPreference("pdfjs.disabled", true); firefoxProfile.setPreference("browser.helperApps.alwaysAsk.force",false); firefoxProfile.setPreference("plugin.scan.plid.all",false); firefoxProfile.setPreference("plugin.scan.Acrobat","99.0");
But still, both browsers open PDF instead of saving.
Any ideas?
source share