Selenium with Edge:带有“null”响应的异常
Selenium with Edge: A exception with a `null` response
我在将 Selenium 与 Edge 结合使用时遇到问题。我使用 .NET Core 3.0.
这是我的简单测试:
[Fact]
public void EdgeDriverTest1() {
using (IWebDriver driver = new EdgeDriver()) {
driver.Navigate().GoToUrl("http://www.google.com");
IWebElement element = driver.FindElement(By.Name("q"));
element.SendKeys("Hello, Selenium WebDriver!");
element.Submit();
}
}
当我 运行 时,Edge window 将被打开,我收到错误消息:
OpenQA.Selenium.WebDriverException
: A exception with a null
response
was thrown sending an HTTP request to the remote WebDriver server for
URL http://localhost:60127/session
. The status of the exception was
UnknownError
, and the message was: An error occurred while sending the
request
Nuget 包:
我该如何解决?
您的代码是正确的,出现此错误主要是因为您使用的 Microsoft WebDriver 版本与您使用的 Edge 版本不匹配。
如果您使用的是 18 之前的 Edge 版本,您可以在 this link. If your Microsoft Edge version is 18 or higher, you can install the appropriate webdriver version according to the ways in this article.[=11= 下载适用于您安装的 Microsoft Edge 版本的网络驱动程序]
我在将 Selenium 与 Edge 结合使用时遇到问题。我使用 .NET Core 3.0.
这是我的简单测试:
[Fact]
public void EdgeDriverTest1() {
using (IWebDriver driver = new EdgeDriver()) {
driver.Navigate().GoToUrl("http://www.google.com");
IWebElement element = driver.FindElement(By.Name("q"));
element.SendKeys("Hello, Selenium WebDriver!");
element.Submit();
}
}
当我 运行 时,Edge window 将被打开,我收到错误消息:
OpenQA.Selenium.WebDriverException
: A exception with anull
response was thrown sending an HTTP request to the remote WebDriver server for URLhttp://localhost:60127/session
. The status of the exception wasUnknownError
, and the message was: An error occurred while sending the request
Nuget 包:
我该如何解决?
您的代码是正确的,出现此错误主要是因为您使用的 Microsoft WebDriver 版本与您使用的 Edge 版本不匹配。
如果您使用的是 18 之前的 Edge 版本,您可以在 this link. If your Microsoft Edge version is 18 or higher, you can install the appropriate webdriver version according to the ways in this article.[=11= 下载适用于您安装的 Microsoft Edge 版本的网络驱动程序]