【发布时间】:2012-11-17 04:49:24
【问题描述】:
我正在使用此代码自动化流程,该流程将在没有提示的情况下下载 Winzip 文件。 但这似乎不起作用
profile = webdriver.firefox.firefox_profile.FirefoxProfile()
profile.set_preference('browser.helperApps.neverAsk.saveToDisk',("application/zip,
application/octet-stream"))
profile.set_preference('browser.download.folderList', 2)
profile.set_preference('browser.download.dir', '/home/jack/DOWNLOAD')
self.driver = webdriver.Firefox(firefox_profile=profile)
我仍然看到在自动化时打开的对话框。
【问题讨论】:
-
如果您在第一次下载时手动禁用提示,之后的下载是否正常工作?
-
@root 不,我也无法手动完成。此外,
browser.download.dir中不存在about:config -
如果你在 linux 上,下面的命令会给你什么
curl -I https://www.downloadadress.com/ | grep Content-Type -
您是否也尝试过将
application/x-zip-compressed和application/x-rar-compressed作为 MIME 类型? -
@RocketDonkey 是的,我试过了,但很有道理。
标签: python selenium automation