我正在为ApplicationBrowser类创建对象,该对象存在于一种解决方案中,其中我将一条路径作为字符串传递,并且它创建了chrome驱动程序的实例。 Chromedriver是中提供的API。这样做时,我遇到以下异常:
Could not load file or assembly 'WebDriver, Version=3.9.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)
我的代码:
ApplicationBrowser webApp = new ApplicationBrowser(path);
public ApplicationBrowser(string driverLocation)
{
ChromeOptions options = new ChromeOptions();
Wb = new ChromeDriver(driverLocation, options);
}
答案 0 :(得分:0)
看起来您没有在声明WebDriver:
WebDriver wb = new ChromeDriver(options);
在wb前面缺少WebDriver
此外,请确保您具有正确的WebDriver: https://www.seleniumhq.org/download/