Matmen Matmen - 3 months ago 10
Java Question

How to set Mozilla Firefox to doesn't open manager download with .iso file?

I have a problem while using the framework Vaadin test bench and Selenium libraries.
For my test i need to say to Mozilla Firefox browser 31.0 version to not open the download manager dialog when i try to download .iso files.
I want that the download start by itself in the path that i had setting.
An example of my JAVA code, i'm using jdk 1.8 on apache tomcat 1.8 and my OS is Windows 8:

public static RemoteWebDriver getFirefoxDriver(String pathDownloadFile) {
final FirefoxProfile firefoxProfile = new FirefoxProfile();
final DesiredCapabilities capability = new DesiredCapabilities();
firefoxProfile.setPreference("browser.download.dir", pathDownloadFile);
firefoxProfile.setPreference("browser.download.manager.showWhenStarting", false);
firefoxProfile.setPreference("browser.download.folderList", 2);
firefoxProfile.setPreference("browser.download.defaultFolder", pathDownloadFile);
firefoxProfile.setPreference("pdfjs.disabled", true);
firefoxProfile.setPreference("plugin.scan.plid.all", false);
firefoxProfile.setPreference("plugin.scan.Acrobat", "99.0");
firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk",
"application/pdf,application/octet-stream,application/xml,text/csv,application/zip,application/vnd.pdf,"
+ "application/x-pdf,application/pkcs7-mime,application/x-pkcs7-mime,application/pkcs7-signature,text/plain,"
+ "application/iso-image");
firefoxProfile.setPreference("browser.helperApps.alwaysAsk.force", false);
firefoxProfile.setEnableNativeEvents(false);
capability.setBrowserName("firefox");
capability.setCapability(FirefoxDriver.PROFILE, firefoxProfile);
WebDriver driver = new RemoteWebDriver(testingbotdotcom, capability);
return driver;

}


That are the settings of the firefox profile. I supposed that the problem is in mime-type but in every forum i read that the mime-type for .iso files are application/iso-image or application/octet-stream but it doesn't work.

Thanks to all for the answer.

Answer

you can determine the mimetype using the following curl command on linux

curl -I "http://ftp.uni-erlangen.de/mirrors/ubuntu-releases/16.04/ubuntu-16.04.1-desktop-amd64.iso" | grep "Content-Type"

which returns

Content-Type: application/x-iso9660-image
Comments