如何使用带有FF 48便携式的marionetteDriver? 我知道它如何与安装的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时我该怎么做?
答案 0 :(得分:2)
终于有效了。 gecko 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);
答案 1 :(得分:0)
尝试与您使用的相同。只有更改只是使用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);