1

如何将 marionetteDriver 与 FF 48 便携式设备一起使用?我知道它如何与已安装的 Firefox 48 一起工作:

String marionetteDriverLocation = getClass().getClassLoader().getResource("[PATH_TO_GECKODRIVER]/wires.exe").getPath();
System.setProperty("webdriver.gecko.driver", marionetteDriverLocation);
WebDriver driver = new MarionetteDriver(createDefaultCapabilitiesFirefox());

和 Firefox 最多可移植 46 个:

FirefoxBinary binary = new FirefoxBinary(new File(firefoxPortablePath));
WebDriver driver = new FirefoxDriver(binary, createFirefoxProfile(),createDefaultCapabilitiesFirefox());

但是,当我想使用便携式 Firefox 48 时,我该怎么办?

4

2 回答 2

2

终于奏效了。壁虎 0.8.0 或 0.9.0 没有区别。非常感谢@Saurabh Gaur 你让我很开心!

工作代码:

String marionetteDriverLocation = getClass().getClassLoader().getResource("[PATH_TO_GECKODRIVER]//wires.exe").getPath();
System.setProperty("webdriver.gecko.driver",marionetteDriverLocation);
DesiredCapabilities capabilities = createDefaultCapabilitiesFirefox();
capabilities.setCapability("marionette", true);
WebDriver driver = new MarionetteDriver(capabilities);
于 2016-08-17T12:23:18.740 回答
0

尝试与您使用 46 相同的方法。仅使用以下更改setCapability("marionette", true);DesiredCapabilities-

String marionetteDriverLocation = getClass().getClassLoader().getResource("[PATH_TO_GECKODRIVER]/wires.exe").getPath();
System.setProperty("webdriver.gecko.driver", marionetteDriverLocation);

DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("marionette", true);

FirefoxBinary binary = new FirefoxBinary(new File(firefoxPortablePath));

WebDriver driver = new FirefoxDriver(binary, createFirefoxProfile(), capabilities);
于 2016-08-17T11:34:15.717 回答