C# Visual Studio selenium for edge OS version18362 [英] C# visual studio selenium for edge OS version18362

查看:82
本文介绍了C# Visual Studio selenium for edge OS version18362的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是使用 Visual Studio 2015 学习 C# selenium 的初学者.我想使用边缘浏览器测试一个随机网站.通过使用NuGet,我安装了selenium support(最新版)v3.141.0、selenium webdriver(最新版)v3.141.0和selenium microsoft webdriver(最新版)v17.17134.0.但是,我的笔记本电脑(最新窗口 10)上的操作系统版本是 18362,无法在官方 webdriver 网站上下载.

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.

以下代码在 chrome、IE 和 firefox 中运行良好,但如果我运行下面的脚本,我可以成功打开边缘浏览器,但它不会相应地继续执行更多步骤(只是边缘浏览器显示空白页).我得到的错误如下: OpenQA.Selenium.WebDriverException:抛出一个空响应异常向远程 WebDriver 服务器发送 HTTP 请求以获取 URL http://localhost:54095/session.异常状态为ReceiveFailure,消息为:底层连接已关闭.意外...."

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

推荐答案

Microsoft WebDriver for Microsoft Edge (EdgeHTML) 版本 18 和 19 是一项 Windows 按需功能,可确保它始终自动保持最新状态并启用一些新方法获取 Microsoft WebDriver.

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

参考:

Microsoft WebDriver

然后再次尝试使用 Edge 浏览器运行您的代码.

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

这篇关于C# Visual Studio selenium for edge OS version18362的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆