I\'m using Selenium with my CI system to automatically test my various applications, one of which is a web form with a downloadable copy of our answers (as a dynamically generat
This is an annoying issue indeed. However, I could figure out how to solve it for Firefox. Maybe you can find a similar solution for other browsers.
Basically, you have to force the browser to download the file without asking for it. You can do that by loading a specially crafted profile.
from selenium import webdriver
myprofile = webdriver.FirefoxProfile('./profile')
myprofile.set_preference('browser.download.dir', '/tmp/my_downloads_folder')
myprofile.set_preference('browser.download.folderList', 2)
myprofile.set_preference('pdfjs.migrationVersion', 1);
browser = webdriver.Firefox(fp)
Besides loading the profile, we also define a downloads folder and disable the pdfjs
plugin.
In ./profile
folder, we have a mimeTypes.rdf
file like this:
I hope it helps you.