Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 416
xGIx Avatar asked Oct 10 '17 14:10

xGIx


People also ask

What is current version of Selenium?

Selenium 4 is the latest version of selenium; Simon Stewart founder of selenium has announced Selenium 4 at the Selenium Conference in Bangalore which consists of few major updates and its planned to release after October 2019 (even though official announcement yet to get).

What is the latest version of Selenium 3?

In selenium 3, the latest version till date is 3.141. Selenium 3.

Why is Selenium used?

Selenium automates web browsers. It is most famous for enabling rapid, repeatable web-app testing, which allows developers to ship new releases faster and with confidence.

What is the difference between Selenium 3 and 4?

In Selenium 3, the chrome driver class directly extends to the Remote Web Driver. But In Selenium 4 Chrome driver class extends to Chromium Driver, which has some predefined methods to access the dev tool.


Video Answer


4 Answers

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.

like image 179
Davide Patti Avatar answered Oct 26 '22 05:10

Davide Patti


Changed the following code 'FirefoxDriver(capabilities) to firefoxOptions which uses .setCapcability()

FirefoxOptions firefoxOptions = new FirefoxOptions();
    firefoxOptions.setCapability("marionette", true);
    webdriver = new FirefoxDriver(firefoxOptions);
like image 45
xGIx Avatar answered Oct 26 '22 05:10

xGIx


Try following:

    FirefoxOptions firefoxOptions = new FirefoxOptions();
    firefoxOptions.setCapability("marionette", true);
    WebDriver driver = new FirefoxDriver(firefoxOptions);
like image 25
fahim reza Avatar answered Oct 26 '22 03:10

fahim reza


You can try this line;

FirefoxOptions ffOpt = new FirefoxOptions();
ffOpt.setCapabilities("marionette", true);
WebDriver driver = new FirefoxDriver(ffOpt);
like image 36
SysMurff Avatar answered Oct 26 '22 03:10

SysMurff