我需要使用加载了扩展的 Firefox 配置文件在 RemoteWebDriver 上运行我的 WebDriver 测试。我目前的代码是
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities = DesiredCapabilities.firefox();
File firebug = new File("firebug.xpi");
File netexpert = new File("netexpert.xpi");
try {
firefoxProfile.addExtension(firebug);
firefoxProfile.addExtension(netexpert);
} catch (IOException e) {}
desiredCapabilities.setCapability(FirefoxDriver.PROFILE, firefoxProfile);
RemoteWebDriver remoteWebDriver = new RemoteWebDriver(<<serverurl here>>, getDesiredCapabilities());
我收到以下错误
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.32.0', revision: '6c40c187d01409a5dc3b7f8251859150c8af0bcb', time: '2013-04-09 10:39:28'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.7.5', java.version: '1.6.0_51'
Driver info: driver.version: RemoteWebDriver
当我没有设置 Firefox 配置文件并且测试运行良好时,我没有收到任何错误。
编辑:在删除 netexpert.xpi 时,测试运行良好。我的独立测试在以相同方式启用 netexpert 的 FirefoxDriver(不是 RemoteWebDriver)上运行良好。