How to Automatically Download Files from a Pop Up Dialog Using Selenium-Python

How to handle pop up window dialog to download file automatically with firefox profile in python selenium on Linux (Ubuntu) system

The correct MIME type for .enc is "text/x-uuencoded"
Updated as below in code and it's working :

profile.set_preference("browser.helperApps.neverAsk.saveToDisk", "text/x-uuencoded")

How can I download a file on a click event using selenium?

Find the link using find_element(s)_by_*, then call click method.

from selenium import webdriver

# To prevent download dialog
profile = webdriver.FirefoxProfile()
profile.set_preference('browser.download.folderList', 2) # custom location
profile.set_preference('browser.download.manager.showWhenStarting', False)
profile.set_preference('browser.download.dir', '/tmp')
profile.set_preference('browser.helperApps.neverAsk.saveToDisk', 'text/csv')

browser = webdriver.Firefox(profile)
browser.get("http://www.drugcite.com/?q=ACTIMMUNE")

browser.find_element_by_id('exportpt').click()
browser.find_element_by_id('exporthlgt').click()

Added profile manipulation code to prevent download dialog.



Related Topics



Leave a reply



Submit