Автозагрузка для firefox в селене с использованием python

Я хочу, чтобы файл автоматически загружался при нажатии на определенную ссылку. Но здесь всплывающее окно с запросом на открытие и сохранение открывается в селене с помощью браузера Firefox.

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()

Здесь я работаю над версией Python 3.6 и Firefox 60.0.1.


person abhi1610    schedule 28.05.2018    source источник
comment
Вы хотите загрузить его физически или хотите убедиться, что этот файл будет загружен, если вы нажмете на ссылку?   -  person Andrei Suvorkov    schedule 28.05.2018
comment
Я хочу загрузить его в определенное место.   -  person abhi1610    schedule 28.05.2018
comment
Вы можете посмотреть здесь. github.com/chriskiehl/pyrobot.   -  person Andrei Suvorkov    schedule 28.05.2018
comment
Это хорошо. Но я хочу сделать это только с селеном, если это возможно.   -  person abhi1610    schedule 28.05.2018
comment
Здесь "text/plain", вероятно, должно быть ",text/plain".   -  person Andrei Suvorkov    schedule 28.05.2018