How to fix DesiredCapabilities in Selenium 4.0

batuarslan :

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());
}
DebanjanB :

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.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=142834&siteId=1