We are using the PhantomJS for the Headless execution of our scripts which are written in Selenium Webdriver(2.42.2)+Java using browser Firefox 29.0.1 . We could able to integrate the PhantomJS successfully with our framework. But the issue we are facing is to set the MIME types using PhantomJS. i.e., Using selenium Webdriver we set the browser level preferences to do the actions like, download the files(pdf,csv,zip etc) but unable to find how to do with PhantomJS.
sample code below for the firefox browser level preferences:
FirefoxProfile profile = new FirefoxProfile();
profile.setEnableNativeEvents(true);
profile.setPreference("browser.download.folderList", 2);
profile.setPreference("browser.download.manager.showWhenStarting",false);
profile.setPreference("browser.download.dir","D:\downloads");
profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/pdf,application/download,application/force-download,application/x-download,text/csv,image/jpeg,application/zip");
profile.setPreference("pdfjs.disabled", true);
Tried passing arguments to "PHANTOMJS_CLI_ARGS" as below:
System.setProperty("phantomjs.download.folderList", "2");
System.setProperty("phantomjs.download.dir","D:\downloads");
but PhantomJS is not recognized the valid input arguments.