OpenQA.Selenium.WebDriverException:'无法在http://localhost:20548/上启动驱动程序服务 [英] OpenQA.Selenium.WebDriverException: 'Cannot start the driver service on http://localhost:20548/'

查看:636
本文介绍了OpenQA.Selenium.WebDriverException:'无法在http://localhost:20548/上启动驱动程序服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试打开EdgeDriver时出现以下错误.

I'm getting the following error when I try to open the EdgeDriver.

OpenQA.Selenium.WebDriverException: 'Cannot start the driver service on http://localhost:20548/'

FirefoxDriver和ChromeDriver正常工作.

The FirefoxDriver and ChromeDriver work just fine.

这是驱动程序的问题吗?

This is an issue with the driver?

端口20548上没有任何内容.以下代码什么也不返回.

There is nothing running on port 20548. The below code returns nothing.

C:\WINDOWS\system32>netstat -a -o | find "20548"

除了将Selenium.WebDriver.MicrosoftWebDriver NuGet降低到我的项目之外,我是否还需要做其他事情?

Did I need to do anything else besides downlowd the Selenium.WebDriver.MicrosoftWebDriver NuGet into my project?

我需要在计算机上安装的唯一软件是最新版本的Microsoft Edge正确吗?

The only software I need installed on my computer is the latest version of Microsoft Edge correct?

推荐答案

我尝试运行项目目录(项目名称,Test)的bin目录中的MicrosoftWebDriver.exe.这给了我所需的答案.

I tried running MicrosoftWebDriver.exe that was in the bin directory of my project (project name, Test). This gave me the answer I needed.

我从以下网站下载了正确的驱动程序:

I downloaded the correct driver from the following website:

https://developer.microsoft.com/zh-cn/microsoft-edge/tools/webdriver/#downloads

================================================ =========

========================================================

进一步更新和解决方案:如何知道要获取哪个驱动程序...

Further Update & Solution: How to know which driver to get ...

我终于找到了正确的驱动程序.有两种获取驱动程序的方法.

I finally found the correct driver. There are two ways to get the driver.

  1. 通过从Microsoft开发人员网站下载
  2. 在可视工作室NuGet管理器中找到它,然后让经理将其配置到您的项目中(首选方法)

方法1 :如何知道要下载哪个驱动程序

Method 1: how to know which driver to download

  1. 转到 Microsoft开发人员网站
  2. 找到发行版本号与Edge浏览器上的版本号相等的发行版
  3. 配置您的项目以找到并使用您下载的MicrosoftWebDriver.exe
  1. Go to the Microsoft developer website
  2. Find the Release which has a Release number equal to the version number on your Edge browser
  3. Configure your project to locate and use the MicrosoftWebDriver.exe you downloaded

方法2 :如何知道要下载哪个驱动程序

Method 2: how to know which driver to download

  1. 在VS中打开测试项目,然后打开NuGet程序包管理器
  2. 浏览Selenium.WebDriver.MicrosoftWebDriver
    • 找到Web驱动程序的版本,其中版本号的后半部分与边缘浏览器的Microsoft EdgeHTML版本号的后半部分匹配(一点都不明显).
  1. Open your test project in VS and open the NuGet package manager
  2. Browse for the Selenium.WebDriver.MicrosoftWebDriver
    • Find the version of the webdriver where the last half of the version number matches the last half of your edge browser's Microsoft EdgeHTML version number (not obvious at all).

单击安装按钮.一切都会在您的项目中自动配置,因此您可以自动开始使用驱动程序

Click in install button. everything will automatically be configured in your project so you can automatically start using the driver

将几行Selenium代码添加到测试项目中,这将打开边缘浏览器(如原始问题所示).

Add the few lines of Selenium code to your test project which will open the edge browser (shown in the original question).

这篇关于OpenQA.Selenium.WebDriverException:'无法在http://localhost:20548/上启动驱动程序服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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