I want to autodownload the file when clicking on particular link. But, here pop up window asking for open and save option gets opened in selenium with firefox browser.
from selenium import webdriver
profile = webdriver.FirefoxProfile()
profile.set_preference("browser.download.folderList", 2)
profile.set_preference("browser.download.manager.showWhenStarting", False)
profile.set_preference("browser.helperApps.neverAsk.saveToDisk", "application/text"+",application/pdf"+",txt/csv/xls"+",text/plain")
profile.set_preference("browser.helperApps.neverAsk.openFile", "application/text"+",application/pdf"+",txt/csv/xls"+"text/plain" )
profile.set_preference("browser.download.dir", tempDir)
url = "http://www.seleniumeasy.com/test/generate-file-to-download-demo.html" #sample website
driver = webdriver.Firefox(executable_path= firefox_path, firefox_profile=profile)
driver.get(url)
inpbox = driver.find_element_by_id("textbox")
inpbox.send_keys("Lorem Ipsum \r\n")
driver.find_element_by_id("create").click()
import time
time.sleep(2)
driver.find_element_by_id("link-to-download").click()
Here I am working on Python 3.6 and Firefox 60.0.1 version.