Search code examples
seleniumselenium-webdriverwebdrivergeckodriver

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


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

Solution

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