title: Save PDF instead of opening in Selenium
body: <p>There was a code I use that would always download the PDF. Since recently it started to open the PDF inside the browser. The same happens for both chrome and firefox.</p>
  
  <p>In chrome I already tried:</p>
  
  <pre><code>DesiredCapabilities capabilities = DesiredCapabilities.chrome();
  capabilities.setCapability("chrome.switches", Arrays.asList("--disable-extensions"));
  driver = new ChromeDriver(capabilities);
  </code></pre>
  
  <p>And in firefox I tried:</p>
  
  <pre><code>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");
  </code></pre>
  
  <p>But still, both browsers are opening the PDF instead of saving it.</p>
  
  <p>Any ideas?</p>