【问题标题】:c# Selenium, select specific Firefox Profilec# Selenium,选择特定的 Firefox Profile
【发布时间】:2019-04-26 21:06:04
【问题描述】:

我正在尝试让我的 selenium 使用具有特定配置文件的 Firefox(在浏览器中保留 cookie 等)。

但是,我为此找到的所有代码都已过时,我似乎无法通过最新的 selenium 和 geckodriver 找到使用它的方法。

任何帮助将不胜感激!

【问题讨论】:

    标签: c# selenium firefox


    【解决方案1】:

    好的,我已经开始工作了,我正在为其他有同样问题的人回答我自己的问题。

    第 1 步:使用配置文件管理器创建新配置文件 第 2 步:将配置文件目录设置为自定义(为了更容易)

    代码:

    FirefoxProfile profile = new FirefoxProfile(@"D:\FFprofile");
                FirefoxOptions options = new FirefoxOptions();
                options.Profile = profile;
    
                FirefoxDriver driver = new FirefoxDriver(options);
    

    然后 FF 使用此配置文件打开

    【讨论】:

      猜你喜欢
      • 2021-01-10
      • 2012-08-24
      • 2021-12-10
      • 1970-01-01
      • 2011-01-02
      • 2018-12-27
      • 1970-01-01
      • 1970-01-01
      • 2014-07-29
      相关资源
      最近更新 更多