【问题标题】:Selenium WebDriver Load both a Capability and ProfileSelenium WebDriver 同时加载功能和配置文件
【发布时间】:2015-09-23 15:56:46
【问题描述】:

希望同时加载 DesiredCapabilities 和 FirefoxProfile,无法弄清楚,也找不到答案

【问题讨论】:

标签: java selenium


【解决方案1】:

RemoteWebDriver 有FirefoxDriver.PROFILE 功能。 例如,

FirefoxProfile yourProfile = new FirefoxProfile("path_to_your_profile");    
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability(FirefoxDriver.PROFILE, yourProfile);

【讨论】:

    【解决方案2】:

    创建您的 Firefox 配置文件,即:“profileFF”

    DesiredCapabilities cap = new DesiredCapabilities();
    ProfilesIni profile = new ProfilesIni();
    FirefoxProfile myprofile = profile.getProfile("profileFF");
    cap.setCapability(FirefoxDriver.PROFILE, myprofile );
    

     DesiredCapabilities cap = new DesiredCapabilities();  
     File firefoxProfileFolder = new File("/path/to/your/firefox/profile/profileFF");
     FirefoxProfile myprofile = new FirefoxProfile(firefoxProfileFolder);
     cap.setCapability(FirefoxDriver.PROFILE, myprofile );
    

    【讨论】:

      猜你喜欢
      • 2014-11-25
      • 2013-08-12
      • 2019-03-15
      • 2013-01-06
      • 1970-01-01
      • 1970-01-01
      • 2017-01-19
      • 2013-04-04
      相关资源
      最近更新 更多