我有这个:
System.setProperty("webdriver.gecko.driver", "gecko/linux/geckodriver");
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("network.proxy.no_proxies_on", "localhost");
profile.setPreference("javascript.enabled", true);
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("marionette", true);
capabilities.setCapability(FirefoxDriver.PROFILE, profile);
FirefoxOptions options = new FirefoxOptions();
options.setLogLevel(Level.FINEST);
options.addPreference("browser.link.open_newwindow", 3);
options.addPreference("browser.link.open_newwindow.restriction", 0);
现在我有两个不同的构造函数:
WebDriver driver = new FirefoxDriver(capabilities);
和
WebDriver driver = new FirefoxDriver(options);
我怎样才能将它们(功能和选项)都传递到driver
?顺便说一句,IDE 告诉我它FirefoxDriver(capabilities)
已被弃用。