已弃用DesiredCapabilities,如何在Selenium Webdriver C#中使用SetCapability?
我可以这样使用吗?
capacidades = new ChromeOptions();
capacidades.AddAdditionalCapability(@"browserName", @"chrome");
答案 0 :(得分:0)
在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);
}