C# visual studio selenium for edge OS version18362

大憨熊 提交于 2021-01-29 08:38:18

问题


I am beginner of learning C# selenium using visual studio 2015. I want to test a random website using edge browser. With the use of NuGet, I have installed selenium support (latest version)v3.141.0, selenium webdriver (latest version)v3.141.0 and selenium microsoft webdriver (latest version)v17.17134.0. However, the OS version on my laptop (latest window 10) is 18362 which is not available to download on official webdriver website.

The following code works well in chrome, IE, and firefox, but if I run the script below, I could successfully open the edge browser, but it does not proceed any more steps accordingly (just a edge browser displaying blank page). The error I get is as followed: OpenQA.Selenium.WebDriverException: "A exception with a null response was thrown sending an HTTP request to the remote WebDriver server for URL http://localhost:54095/session. The status of the exception was ReceiveFailure, and the message was: the underlying connection was closed. An unexpected ...."

I searched through the entire internet but still could not find out any relevant resources teaching how to configure edge webdriver in my current situation. Can someone point out mistakes I made and advise what should be done to solve this issue?

[TestMethod]
public void TestInEdge()
{
    // Default option, MicrosoftWebDriver.exe must be in PATH
    IWebDriver driver = new EdgeDriver();
    driver.Navigate().GoToUrl("http://testwisely.com/demo");
    System.Threading.Thread.Sleep(1000);
    driver.Quit();
}

回答1:


Microsoft WebDriver for Microsoft Edge (EdgeHTML) versions 18 and 19 is a Windows Feature on Demand which ensures that it’s always up to date automatically and enables some new ways to get Microsoft WebDriver.

To get started you will have to enable Developer Mode:

Go to Settings > Update and Security > For Developer and then select “Developer mode”.

To install run the following in an elevated command prompt:

DISM.exe /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~0.0.1.0

Reference:

Microsoft WebDriver

Then after again try to run your code with Edge browser.



来源:https://stackoverflow.com/questions/59234658/c-sharp-visual-studio-selenium-for-edge-os-version18362

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