1

我用谷歌搜索了一下,但没有找到我的问题的答案。我想让 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);

你能帮忙吗?

4

0 回答 0