如何使用RemoteWebDriver指示Firefox配置文件

时间:2010-12-07 17:08:59

标签: selenium webdriver selenium-webdriver

查看Selenium 2.0(alpha 7)源代码,似乎可以通过功能API设置RemoteWebDriver的Ff配置文件。但目前尚不清楚如何做到这一点。

有什么想法吗?

2 个答案:

答案 0 :(得分:9)

FirefoxProfile profile = new FirefoxProfile();

// OR
// FirefoxProfile profile = new FirefoxProfile(new File(...));      

// Init your profile 

// OR
// If you created the profile by providing a path to it,
// the path should refer to the one on the host of the WD server

DesiredCapabilities caps = DesiredCapabilities.firefox();
caps.setCapability(FirefoxDriver.PROFILE, profile);

WebDriver driver = new RemoteWebDriver(new URL("http://<....>:4444/wd/hub"), caps);

答案 1 :(得分:2)

您可以为每个Selenium grid 2节点分配一个特定的firefox配置文件,只需设置 webdriver.firefox.profile 属性:

java -jar selenium-server-standalone-2.37.0.jar -Dwebdriver.firefox.profile = my-profile -role node -hub http://mydomain.com:4444/grid/register

  • webdriver.firefox.profile的值必须是firefox配置文件名称,而不是位置或文件夹名称

http://automatictester.wordpress.com/2013/04/07/selenium-running-custom-firefox-profile/

相关问题