我在哪里可以找到 geckodriver 的选项 class 的参数?

Where can I find arguments for options class for geckodriver?

我在 Python 和 firefox 浏览器中使用 selenium,我正在尝试下载一个文件,然后 禁用 弹出 window 询问我是否想保存它和在哪里:

由于 FirefoxProfile 和 FirefoxOptions 并在 selenium 4.0.0 + 中被弃用,我正在尝试使用 Options() class 来替换它

选项class有多种参数可供选择,例如:

        options = Options()
    options.add_argument("--headless")

但是我需要参数来禁用上面附加的下载 window。 我搜索了很多,但找不到任何关于可以传递给 options.add_argument 的可能参数的文档。

我已经尝试降级到早期版本并添加 FirefoxProfile 参数,例如:

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

但是还是不行

如果有人可以分享一份文档,说明选项的可能参数,或者只是指定禁用此弹出窗口的具体参数 - 那就太好了。

谢谢!

我在我的框架中设置了这些首选项,到目前为止效果很好

profile.set_preference("browser.helperApps.neverAsk.saveToDisk", "application/csv,application/excel,application/vnd.ms-excel,application/vnd.msexcel,text/anytext,text/comma-separated-values,text/csv,text/plain,text/x-csv,application/x-csv,text/x-comma-separated-values,text/tab-separated-values,data:text/csv")
profile.set_preference("browser.helperApps.neverAsk.saveToDisk", "application/xml,text/plain,text/xml,image/jpeg,application/octet-stream,data:text/csv")
profile.set_preference("browser.download.manager.showWhenStarting",False)
profile.set_preference("browser.helperApps.neverAsk.openFile","application/csv,application/excel,application/vnd.ms-excel,application/vnd.msexcel,text/anytext,text/comma-separated-values,text/csv,text/plain,text/x-csv,application/x-csv,text/x-comma-separated-values,text/tab-separated-values,data:text/csv")
profile.set_preference("browser.helperApps.neverAsk.openFile","application/xml,text/plain,text/xml,image/jpeg,application/octet-stream,data:text/csv")
profile.set_preference("browser.helperApps.alwaysAsk.force", False)
profile.set_preference("browser.download.useDownloadDir", True)
profile.set_preference("dom.file.createInChild", True)

可能这些设置中的大部分对您来说都是多余的,但它们在将来可能会很有用。