【问题标题】:Looking for Selenium command line options for Firefox [duplicate]寻找 Firefox 的 Selenium 命令行选项 [重复]
【发布时间】:2019-03-12 19:38:47
【问题描述】:

我正在寻找 Firefox 的 Selenium 命令行选项来更改用户目录。基本上,我目前正在使用以下命令行选项来更改 Chrome 中的用户数据目录,并且我正在为 Firefox 寻找类似的命令行选项。我似乎无法在 Internet 上找到它。对此的任何帮助将不胜感激。

chromeOptions=["user-data-dir=C:\temp"]

谢谢。

【问题讨论】:

    标签: selenium firefox


    【解决方案1】:

    我没有答案,但我可以扔掉一个可能有助于找到它的资源。

    Here are various options in firefox

    您可能需要设置 browser.cache.disk.parent_directory 或类似的选项。

    虽然我不能确定,因为我自己从未通过命令行设置这些选项。不过,我总是通过这样的方式做到这一点:

    FirefoxOptions ff = new FirefoxOptions();
    FirefoxProfile profile = new FirefoxProfile();
    profile.SetPreference("browser.download.dir", "%path%");
    profile.SetPreference("browser.download.folderList", 2);
    profile.SetPreference("browser.helperApps.neverAsk.saveToDisk", "text/csv,application/pdf,application/octet-stream,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
    ff.Profile = profile;
    

    希望这比没有答案更有帮助:)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-02-28
      • 1970-01-01
      • 1970-01-01
      • 2021-04-08
      • 1970-01-01
      • 1970-01-01
      • 2011-03-20
      • 1970-01-01
      相关资源
      最近更新 更多