Reputation: 21
I would like to download a bunch of files using web-driver, I am able to download 1 file type however cant seem to be able to download mix file format.
I have also used HttpFox to work out the file format to use in webdriver. Below is the code I have to download a PNG file:
fp = webdriver.FirefoxProfile()
fp.set_preference("browser.download.dir", "/User/Download")
fp.set_preference("browser.download.folderList", 2)
fp.set_preference("browser.helperApps.alwaysAsk.force", False)
fp.set_preference("browser.download.manager.showWhenStarting", False)
fp.set_preference("browser.helperApps.neverAsk.openFile", "image/png")
fp.set_preference("browser.helperApps.neverAsk.saveToDisk", "image/png")
The rest of the formats are "text/html", "image/tiff", "text/csv", "application/zip", "application/octet-stream"
Thanks for looking and your help :)
Upvotes: 2
Views: 4489
Reputation: 32865
Just put them together separated with comma. (But you need to make sure the MIME types are correct.)
fp.set_preference("browser.helperApps.neverAsk.openFile", "image/png, text/html, image/tiff, text/csv, application/zip, application/octet-stream")
fp.set_preference("browser.helperApps.neverAsk.saveToDisk", "image/png, text/html, image/tiff, text/csv, application/zip, application/octet-stream")
Upvotes: 6