c# - 不推荐使用 DesiredCapabilities,我将如何在 selenium webdriver C# 中使用 SetCapability?
问题描述
不推荐使用 DesiredCapabilities,我将如何在 selenium webdriver C# 中使用 SetCapability?
我可以这样使用吗?
capacidades = new ChromeOptions();
capacidades.AddAdditionalCapability(@"browserName", @"chrome");
解决方案
在 JimEvans 的答案中添加一个简单的示例。
禁用 chrome 信息栏的简单示例:
private IWebDriver GetChromeDriver()
{
var outPutDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
//Disable chrome info bar in order to prevent "Chrome is being run by automation software."
var chromeOption = new ChromeOptions();
chromeOption.AddArguments("disable-infobars");
return new ChromeDriver(outPutDirectory, chromeOption);
}
推荐阅读
- swift - SwiftUI:如何使用 UserDefaults 保存选择器数据?
- python - 遍历字典并将网页(值)保存到以键为名称的文件中
- excel - FindElementByXPath 从工作表中的单元格值
- python - 网站正在检测 SELENIUM。这怎么可能?
- assembly - MIPS:多个 BEQ 语句如何工作?
- javascript - 尝试从公共 api 获取 json 数据时出错
- scheme - 如何在方案中获得树的产品
- mysql - 在重复更新时将许多插入到 sql 表中
- r - 分组并保留在不同列中具有最大值的整行
- c++ - static_cast
与 static_cast