Selenium Web驱动程序问题

时间:2019-10-15 01:25:37

标签: selenium-webdriver

最近,我的chrome版本已从75版本更新为77.0.3865.120(64位)。我的程序以前可以与版本75和与75相关的chrome驱动程序一起使用,现在我的chrome浏览器已更新为77.0.3865.120(64位),但出现以下错误消息

**An unhandled exception of type 'System.InvalidOperationException' occurred in WebDriver.dll
Additional information: invalid argument: entry 0 of 'firstMatch' is invalid
from invalid argument: unrecognized capability: chromeOptions**

这是我的代码:

 ChromeOptions chromeOptions = new ChromeOptions();
 chromeOptions.AddArguments("window-size=800,600");
 chromeOptions.AddArgument("no-sandbox");

 DesiredCapabilities capabilities = DesiredCapabilities.Chrome();
 capabilities.SetCapability(ChromeOptions.Capability, chromeOptions);
 using (IWebDriver driver = new ChromeDriver("local path to driver", chromeOptions)) -- error at this line

1 个答案:

答案 0 :(得分:0)

如果您使用的是Google Chrome 77.00版本,则需要下载 Chromedriver 77.00,以下是链接: https://chromedriver.storage.googleapis.com/index.html?path=77.0.3865.40/