Selenium 3.6.0 & webdriver = new FirefoxDriver(capabilities) - 已弃用?
Selenium 3.6.0 & webdriver = new FirefoxDriver(capabilities) - deprecated?
自升级到最新版本的 Selenium 后,以下代码似乎已被弃用:
Selenium 3.6.0 & webdriver = new FirefoxDriver(capabilities) - deprecated?
完整代码:
System.setProperty("webdriver.gecko.driver", Base_Page.getConstant(Constant.GECKO_DRIVER_DIRECTORY));
DesiredCapabilities capabilities=DesiredCapabilities.firefox();
capabilities.setCapability("marionette", true);
webdriver = new FirefoxDriver(capabilities); //deprecated
来自https://raw.githubusercontent.com/SeleniumHQ/selenium/master/rb/CHANGES
3.4.1 (2017-06-13)
==================
Firefox:
* Added new Firefox::Options class that should be used to customize browser
behavior (command line arguments, profile, preferences, Firefox binary, etc.).
The instance of options class can be passed to driver initialization using
:options key. Old way of passing these customization directly to driver
initialization is deprecated.
从 3.4.1 版本开始,应使用 FirefoxOptions。
将以下代码“FirefoxDriver(capabilities)
更改为使用 .setCapcability()
的 firefoxOptions
FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.setCapability("marionette", true);
webdriver = new FirefoxDriver(firefoxOptions);
你可以试试这条线路;
FirefoxOptions ffOpt = new FirefoxOptions();
ffOpt.setCapabilities("marionette", true);
WebDriver driver = new FirefoxDriver(ffOpt);
尝试以下操作:
FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.setCapability("marionette", true);
WebDriver driver = new FirefoxDriver(firefoxOptions);
自升级到最新版本的 Selenium 后,以下代码似乎已被弃用:
Selenium 3.6.0 & webdriver = new FirefoxDriver(capabilities) - deprecated?
完整代码:
System.setProperty("webdriver.gecko.driver", Base_Page.getConstant(Constant.GECKO_DRIVER_DIRECTORY));
DesiredCapabilities capabilities=DesiredCapabilities.firefox();
capabilities.setCapability("marionette", true);
webdriver = new FirefoxDriver(capabilities); //deprecated
来自https://raw.githubusercontent.com/SeleniumHQ/selenium/master/rb/CHANGES
3.4.1 (2017-06-13)
==================
Firefox:
* Added new Firefox::Options class that should be used to customize browser
behavior (command line arguments, profile, preferences, Firefox binary, etc.).
The instance of options class can be passed to driver initialization using
:options key. Old way of passing these customization directly to driver
initialization is deprecated.
从 3.4.1 版本开始,应使用 FirefoxOptions。
将以下代码“FirefoxDriver(capabilities)
更改为使用 .setCapcability()
firefoxOptions
FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.setCapability("marionette", true);
webdriver = new FirefoxDriver(firefoxOptions);
你可以试试这条线路;
FirefoxOptions ffOpt = new FirefoxOptions();
ffOpt.setCapabilities("marionette", true);
WebDriver driver = new FirefoxDriver(ffOpt);
尝试以下操作:
FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.setCapability("marionette", true);
WebDriver driver = new FirefoxDriver(firefoxOptions);