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??

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

2 Answers 2

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).

0

I tried this in my nightwatch.json file

"firefox": {
      "desiredCapabilities": {
        "browserName": "Firefox",
          'moz:firefoxOptions': {
            prefs: {
              'browser.helperApps.neverAsk.saveToDisk': 'image/jpeg;application/binary;application/pdf;text/plain;application/text;text/xml;application/xml;text/html;text/csv;video/mp4'
            },
          }
        
      }
    }

and it helped, although I am still looking if someone can help me out with s similar config for safari

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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