how to handle firefox download popup in selenium



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



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



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2