Access to file download dialog in Firefox Access to file download dialog in Firefox selenium selenium

Access to file download dialog in Firefox


I have a solution for this issue, check the code:

FirefoxProfile firefoxProfile = new FirefoxProfile();firefoxProfile.setPreference("browser.download.folderList",2);firefoxProfile.setPreference("browser.download.manager.showWhenStarting",false);firefoxProfile.setPreference("browser.download.dir","c:\\downloads");firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk","text/csv");WebDriver driver = new FirefoxDriver(firefoxProfile);//new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capability);driver.navigate().to("http://www.myfile.com/hey.csv");


I was stuck with the same problem, but I found a solution. I did it the same way as this blog did.

Of course this was Java, I've translated it to Python:

fp = webdriver.FirefoxProfile()fp.set_preference("browser.download.folderList",2)fp.set_preference("browser.download.manager.showWhenStarting",False)fp.set_preference("browser.download.dir",getcwd())fp.set_preference("browser.helperApps.neverAsk.saveToDisk","text/csv")browser = webdriver.Firefox(firefox_profile=fp)

In my example it was a CSV file. But when you need more, there are stored in the ~/.mozilla/$USER_PROFILE/mimeTypes.rdf


Not that I know of. But you can configure Firefox to automatically start the download and save the file in a specific place. Your test could then check that the file actually arrived.