【发布时间】:2019-08-15 10:02:33
【问题描述】:
安装程序为 Windows 10 v1903 和 Visual Studio 2019 v16.2.2
我已经使用以下命令安装了 EdgeDriver:
DISM.exe /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~0.0.1.0
然后,我创建了一个新的 .NET Core 控制台应用程序,并向其中添加了最新的 Selenium.WebDriver NuGet 包 (v3.141.0)。然后我将代码添加到 Program.cs,使其看起来像这样:
using OpenQA.Selenium.Edge;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
var edgeOptions = new EdgeOptions { AcceptInsecureCertificates = true };
new EdgeDriver(edgeOptions);
}
}
}
当我运行控制台应用程序时,执行new EdgeDriver(edgeOptions); 行时出现以下错误。
OpenQA.Selenium.WebDriverException
HResult=0x80131500
Message=The specified arguments passed to the command are invalid.
Source=WebDriver
StackTrace:
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
at ConsoleApp1.Program.Main(String[] args) in ********\Program.cs:line 10
但是,如果我将 AcceptInsecureCertificates 的值从 true 更改为 false,那么我不会有任何异常,并且浏览器会按预期打开。这感觉像是一个错误,但我不知道是 Selenium 还是 EdgeDriver 有问题。
【问题讨论】:
-
我拥有的 EdgeHTML 版本是 18.18362,但我不清楚如何确定代码使用的是哪个版本的 Web 驱动程序。正如我在问题中所说,我已经使用 DISM 安装了网络驱动程序,所以我猜这就是它正在使用的,但我怎么能确定呢?
-
discussion 对您有帮助吗?
标签: selenium selenium-webdriver certificate microsoft-edge selenium-edgedriver