如何修复Selenium 4.0中的DesiredCapabilities [英] How to fix DesiredCapabilities in Selenium 4.0
问题描述
我有一段代码为网格设置浏览器名称.但是,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 v4.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 v3.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屋!