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

xGIx picture xGIx · Oct 10, 2017 · Viewed 12.4k times · Source

Since upgrading to the latest version of Selenium the following code seems to be deprecated:

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

Full 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

Answer

Davide Patti picture Davide Patti · Oct 10, 2017

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

From the 3.4.1 version the FirefoxOptions should be used.