如何修复Selenium 4.0中的DesiredCapabilities [英] How to fix DesiredCapabilities in Selenium 4.0

查看:629
本文介绍了如何修复Selenium 4.0中的DesiredCapabilities的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一段代码为网格设置浏览器名称.但是,Selenium 4.0中不推荐使用DesiredCapabilities.如何修复此代码,使其与4.0中的代码相同?

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

推荐答案

Selenium v​​4.x 仍处于 alpha 阶段,尚未发布,供生产的通用可用性(GA).

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

快照:

建议将继续使用 Selenium v​​3.141.59 ,并使您的框架适应

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.

这篇关于如何修复Selenium 4.0中的DesiredCapabilities的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆