web-dev-qa-db-de.com

Selenium 3.6.0 & webdriver = neuer FirefoxDriver (Fähigkeiten) - veraltet?

Seit dem Upgrade auf die neueste Version von Selenium scheint der folgende Code veraltet zu sein:

Selenium 3.6.0 & webdriver = new FirefoxDriver(capabilities) - deprecated? 

Vollständiger Code:

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
6
xGIx

Von 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.

Ab der Version 3.4.1 sollten die FirefoxOptions verwendet werden.

10
Davide Patti

Der folgende Code 'FirefoxDriver(capabilities)' wurde zu firefoxOptions geändert, der .setCapcability() verwendet.

FirefoxOptions firefoxOptions = new FirefoxOptions();
    firefoxOptions.setCapability("marionette", true);
    webdriver = new FirefoxDriver(firefoxOptions);
5
xGIx

Versuchen Sie folgendes:

    FirefoxOptions firefoxOptions = new FirefoxOptions();
    firefoxOptions.setCapability("marionette", true);
    WebDriver driver = new FirefoxDriver(firefoxOptions);
1
fahim reza

Sie können diese Zeile ausprobieren.

FirefoxOptions ffOpt = FirefoxOptions();
ffOpt.setCapabilities("marionette", true);
WebDriver driver = FirefoxDriver(ffOpt);
0
SysMurff