2

I have a piece of code which sets browser name for the grid. However, DesiredCapabilities is deprecated in Selenium 4.0. How can I fix this code so that it works as the same in 4.0?

DesiredCapabilities capabilities = new DesiredCapabilities();

if (prop.getBrowser().equalsIgnoreCase("chrome")){
capabilities.setBrowserName(DesiredCapabilities.chrome().getBrowserName());
}
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • I'm thinking this might answer your question. Please, check if their solution works for you as well or not – RegCent Apr 25 '19 at 07:57

1 Answers1

3

For the record Selenium v4.x is still in alpha stage and yet to be released for General availability (GA) for Production usage.

Snapshot:

Selenium4x


Recommended Usage

The recommendation will be to continue using Selenium v3.141.59 and keep your framework adjusted to the current implementation of DesiredCapabilities class till Selenium v4.x is GAed for production use successfully completing the alpha and beta cycles.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • Thanks for your answer. I am using 3.141 at the moment but my question was about what to do when I have to migrate to the new version. –  Apr 26 '19 at 08:24
  • Need to wait for the final **jars**, associated **javadocs** and the **API Documentation** to be published to make the transition smoother. – undetected Selenium Apr 26 '19 at 08:27
  • I tried to switch to 4.0.0 because the docker images for chromedriver are using Selenium standalone 4.0.0-beta-1 so I thought it would be better to match the server version than to stick with the stable 3.141.59 client. – absmiths Jan 12 '21 at 17:32