首页 > 解决方案 > 无法加载文件或程序集'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);
        }

标签: seleniumselenium-chromedriver

解决方案


看起来您没有声明 WebDriver:

WebDriver wb = new ChromeDriver(options);

缺少 wb 前面的 WebDriver

另外,请确保您拥有正确的 WebDriver: https ://www.seleniumhq.org/download/


推荐阅读