OpenQA.Selenium.DriverServiceNotFoundException 传递 BinaryLocation 时

OpenQA.Selenium.DriverServiceNotFoundException when passing BinaryLocation

我正在尝试创建 OpenQA.Selenium.Chrome.ChromeDriver 的实例(v81 with Selenium 4.0.0-alpha05)并使用 constructor-overload that gets an instance of ChromeOptions. The only option that I set is BinaryLocation,它的值为 "C:\git\Selenium\Drivers\ChromeDriver81\Win\chromedriver.exe" 和那个文件存在。

不过,我确实明白了:

OpenQA.Selenium.DriverServiceNotFoundException: The chromedriver.exe file does not exist 
in the current directory or in a directory on the PATH environment variable.
The driver can be downloaded at http://chromedriver.storage.googleapis.com/index.html.    

   bei OpenQA.Selenium.DriverService.FindDriverServiceExecutable(String executableName, Uri downloadUrl)    
   bei OpenQA.Selenium.Chrome.ChromeDriverService.CreateDefaultService()   
   bei OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeOptions options)

我是不是误解了什么或者 webdriver-beta 或 ChromeDrv 中某处有错误?

P.S: WebDriver 3.1 和 Firefox (geckodriver73) 在设置 options.BrowserExecutableLocation.

时也会发生这种情况

原来它误解了 BinaryLocation 和 BrowserExecutableLocation 属性的用途。这些属性用于描述 浏览器 的位置。 driver 可执行文件的位置在 CreateDefaulfService() 的重载中指定,它采用一个字符串,指示驱动程序的路径。我需要实例化 ChromeDriverService 并将该实例传递给 ChromeDriver 的构造函数。