1

asked this question earlier, but now i will ask again with bit more explanation of what i did, I could not get it worked please help me out.

I am trying to download a file which is having a .exe extension but it is actually showing as a binary file (MIME type is application/octet-stream ) when i checked the GET request from the server, and i wrote the below code for setting up the firefox preferences which included binary file too.

firefoxProfile.setPreference("browser.download.folderList", 2);
        firefoxProfile.setPreference("browser.helperApps.neverAsksaveToDisk", "application/x-msexcel,text/html,application/xop+xml,application/vnd.ms-excel.sheet.binary.macroenabled.12,application/vnd.wap.wbxml,application/octet-stream,application/x-authorware-bin,application/x-bcpio,text/plain,application/x-msdownload,application/excel,application/x-excel,application/excel,application/x-excel,application/excel,application/vnd.ms-excel,application/x-excel,application/x-msexcel");
    firefoxProfile.setPreference("browser.download.manager.showWhenStarting", false);

        firefoxProfile.setPreference("browser.download.dir", "C:\\Users\\Downloads");
firefoxProfile.setPreference("browser.privatebrowsing.autostart", true);
    GlobalVariables.BrowserDriver = new FirefoxDriver(firefoxProfile);

when i click the link for downloading, it is still asking for the save message, and the confusing part is at this stage i opened another tab in firefox and checked the preferences and its all set as false. that means the code part is working to set up preferences but save pop up message is still coming, i have no idea what is the problem here. If someone knows please guide me,

thanks

marked as duplicate by IAmMilinPatel, Bharat Mane, NarendraC, ECiurleo, kirbycope May 22 '17 at 2:01

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • It is a duplicate but not answered yet, even though my comment on the other one should be the eventual answer. If you provide more specifics on how the popup itself is being generated we can answer that for you, but it really depends on the way it's being generated as if it's a browser control or custom code. Browser settings only take you so far... – mutt May 17 '17 at 20:05
  • Hi Mutt, i will try to give that, sorry for late reply, :) – sarath May 29 '17 at 18:54
0

Instead of avoiding it why not just handle the popup window and click the appropriate button? You can find the popup by iterating through the window handles, have the driver switch focus to it, and click the the appropriate button.

See here for actual code example

https://stackoverflow.com/questions/19403949/how-to-handle-pop-up-in-selenium-webdriver-using-java

Not the answer you're looking for? Browse other questions tagged or ask your own question.