python Selenium : Firefox auto download everything

标签 python selenium

我正在尝试从网站下载一个 csv 文件,无论我尝试保存和打开多少 MIME,对话框仍然出现。有没有办法一次性覆盖所有 MIME 或任何可能弹出的内容?

现在我正在使用:

fp.set_preference("browser.helperApps.neverAsk.saveToDisk","text/html")
fp.set_preference("browser.helperApps.neverAsk.openFile","text/html")

以及其他变体,包括更多的 MIME。我怎样才能不考虑 MIME 自动下载?

最佳答案

我用这个解决了我的问题:

fp.set_preference("browser.helperApps.neverAsk.saveToDisk","application/octet-stream")
fp.set_preference("browser.helperApps.neverAsk.openFile","application/octet-stream")

我有多个偏好声明,我认为这就是问题所在。现在我只有这一个处于事件状态并且没有任何问题。希望这可以帮助其他人。

关于 python Selenium : Firefox auto download everything,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28758082/

相关文章:

python - 参数必须是字符串或数字,而不是 'NoneType'

python - 无法构建 boost_python 示例代码 "fatal error LNK1181: cannot open input file ' boost_python.lib'"

python - Matplotlib (Python) 标准化数据

python - 无法隐藏或禁用 QWizard 上的关闭按钮

python - 使用 selenium (Python) 轮换服务器 IP

Python 游戏服务器 - 优化网络

python - 如何通过子标签中的文本定位标签

javascript - Node.js selenium webdriver - 在测试中获取浏览器功能?

php - Codeception vs peridot + php-webdriver?

CSS/ Selenium : visiblity of an element does not change