Skip to content

Instantly share code, notes, and snippets.

@angelovstanton
Last active August 20, 2020 12:06
Show Gist options
  • Save angelovstanton/ce3476263a6551aa4dd1b839d83e0249 to your computer and use it in GitHub Desktop.
Save angelovstanton/ce3476263a6551aa4dd1b839d83e0249 to your computer and use it in GitHub Desktop.
ProfilesIni profile = new ProfilesIni();
FirefoxProfile firefoxProfile = profile.getProfile("xyzProfile");
String downloadFilepath = "c:\\temp";
firefoxProfile.setPreference("browser.download.folderList", 2);
firefoxProfile.setPreference("browser.download.dir", downloadFilepath);
firefoxProfile.setPreference("browser.download.manager.alertOnEXEOpen", false);
firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk",
"application/msword, application/binary, application/ris, text/csv, image/png, application/pdf, text/html, text/plain, application/zip, application/x-zip, application/x-zip-compressed, application/download, application/octet-stream"));
FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.setProfile(firefoxProfile);
WebDriver firefoxDriver = new FirefoxDriver(firefoxOptions);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment