selenium - 无法加载文件或程序集'WebDriver,版本 = 3.9.1.0。(来自 HRESULT 的异常:0x80131044)
问题描述
我正在为 ApplicationBrowser 类创建对象,该对象存在于一个解决方案中,我将一个路径作为字符串传递,它创建了一个 chrome 驱动程序的实例。Chromedriver 是 . 当我这样做时,我遇到了以下异常:
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);
}
解决方案
看起来您没有声明 WebDriver:
WebDriver wb = new ChromeDriver(options);
缺少 wb 前面的 WebDriver
另外,请确保您拥有正确的 WebDriver: https ://www.seleniumhq.org/download/
推荐阅读
- python - 在列表中创建列表的不同方法
- file - 空字符串可以是合法的文件名吗?
- django - 主机文件适用于自定义子域但不适用于自定义域
- mongodb - 如何在mongodb的所有文档中创建一个包含特定字段值的数组?
- laravel - Laravel - 不应静态调用非静态方法
- javascript - 完全向下滚动时固定背景图像
- database - 在数据库中批量写入 WAL 文件不会否定 WAL 文件的目的吗?
- python - 具有多行python数据框的图形
- cryptography - 如何从xpub生成polkadot、filecoin地址
- android - 从 backstack 弹出另一个 Composable 后手动(重新)触发 ViewModel 函数