Well for Firefox, there is something called Browser profilling. This helps you pre-control download prompts which pops-up.
The below code can be used to set preferences.
// To prevent download dialog
profile = webdriver.FirefoxProfile()
profile.set_preference('browser.download.folderList', 2) // custom location of profile
profile.set_preference('browser.download.manager.showWhenStarting', False) // Prevents popup
profile.set_preference('browser.download.dir', '/tmp') // directory to save the downloads
profile.set_preference('browser.helperApps.neverAsk.saveToDisk', 'text/csv') // for probably saving other logs