如何让Selenium在java中使用Marionette加载始终相同的配置文件?

时间:2016-12-12 13:13:31

标签: selenium profile firefox-marionette

我已经用Google搜索了一下,但没有找到我的问题的答案。 我希望Selenium始终使用相同的配置文件打开firefox。这是我的代码:

final File pathBinary = new File(properties.getProperty("firefox.webdriver.path"));
final File profileDir = new File("C:\\temp\\profile");
final FirefoxBinary firefoxBinary = new FirefoxBinary(pathBinary);
final FirefoxProfile firefoxProfile = new FirefoxProfile(profileDir);

System.setProperty("webdriver.gecko.driver", "D:/selenium_drivers/firefox/geckodriver.exe");
capabilities = DesiredCapabilities.firefox();
capabilities.setCapability(FirefoxDriver.PROFILE, firefoxProfile);

capabilities.setCapability("marionette", true);

driver = new FirefoxDriver(capabilities);
你可以帮忙吗?

0 个答案:

没有答案