Selenium with Edge: A exception with a `null` response [duplicate]

我的未来我决定 提交于 2021-01-28 11:52:59

问题


I have a problem with using Selenium with Edge. I use .NET Core 3.0.

This is my simple test:

[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();
    }
}

When I run it Edge window will be opened and I get the error:

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 packages:

How can I fix it?


回答1:


Your code is right and this error occurs mainly because the Microsoft WebDriver version you're using doesn't match the Edge version you're using.

If you're using Edge version prior to 18, you can download the appropriate webdriver for your installed version of Microsoft Edge in 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.



来源:https://stackoverflow.com/questions/56920240/selenium-with-edge-a-exception-with-a-null-response

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!