【问题标题】:How to make FirefoxDriver use existing profile?如何让 FirefoxDriver 使用现有的配置文件?
【发布时间】:2011-12-07 23:12:07
【问题描述】:

我正试图告诉Seleniumorg.openqa.selenium.firefox.FirefoxDriver 使用现有配置文件及其cookie 和代理设置,所以我这样做了:

FirefoxProfile firefoxProfile = new FirefoxProfile(new File("C:\\Users\\name\\AppData\\Local\\Mozilla\\Firefox\\Profiles\\u72231ej.other"));

WebDriver driver = new FirefoxDriver(firefoxProfile);

但似乎无论如何都会创建一个新的配置文件。

【问题讨论】:

    标签: java selenium


    【解决方案1】:
    FirefoxProfile ffprofile = new FirefoxProfile();
    ffprofile.setPreference(); //Set your preference here
    FirefoxDriver driver = new FirefoxDriver(ffprofile);
    

    您可以通过在 Firefox 地址栏中键入 about:config 来获取首选项列表。 新司机将拥有一个应用了您的设置的配置文件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-09-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-24
      • 1970-01-01
      相关资源
      最近更新 更多