2

Code:

case "firefox":
            FirefoxProfile profile = new FirefoxProfile();
            profile.setPreference("browser.download.dir", "Downloads");  // folder
            profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/zip");  // MIME type
            profile.setPreference("pdfjs.disabled", true);  // disable the built-in viewer
            profile.setPreference("browser.download.folderList", 2);
            profile.setPreference("browser.download.panel.shown", false);

            DesiredCapabilities capabilities = DesiredCapabilities.firefox();
            capabilities.setCapability(FirefoxDriver.PROFILE, profile);
            capabilities.setCapability(CapabilityType.ELEMENT_SCROLL_BEHAVIOR, 1);

            webDriver = new FirefoxDriver(capabilities);
            break;

Windows popup which i am getting is:enter image description here

can anyone help me out with this issue??

  • Could you try options.setPreference("browser.download.useDownloadDir", false); or options.setPreference("browser.download.useDownloadDir", true); and try – PDHide Jan 3 at 13:51
  • you can use sikuli (image based automation ) to handle this kind op popups – Sachintha Jan 8 at 12:09
1

You are missing one line for your setup: profile.setPreference("browser.download.manager.showWhenStarting",false);

Also I would check if the browser.download.dir is not missing proper path to disk (plain"Downloads" might not be enough and you should use full path to disk).

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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