OpenQA.Selenium.WebDriverException: '无法在 http://localhost:20548/上启动驱动程序服务'

OpenQA.Selenium.WebDriverException: #39;Cannot start the driver service on http://localhost:20548/#39;(OpenQA.Selenium.WebDriverException: 无法在 http://localhost:20548/上启动驱动程序服务)

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

问题描述

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

OpenQA.Selenium.WebDriverException: '无法在 http://localhost:20548/上启动驱动程序服务'

FirefoxDriver 和 ChromeDriver 工作正常.

这是驱动程序的问题?

端口 20548 上没有任何运行.下面的代码没有返回任何内容.

C:WINDOWSsystem32>netstat -a -o |找到20548"

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

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

解决方案

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

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

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

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

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

  1. 从微软开发者网站下载
  2. 在 Visual Studio NuGet 管理器中找到它,让管理器将其配置到您的项目中(首选方法)

方法一:如何知道要下载哪个驱动

  1. 转到
  2. 配置您的项目以找到并使用您下载的 MicrosoftWebDriver.exe

方法二:如何知道要下载哪个驱动

  1. 在 VS 中打开您的测试项目并打开 NuGet 包管理器
  2. 浏览 Selenium.WebDriver.MicrosoftWebDriver
    • 找到版本号后半部分与边缘浏览器 Microsoft EdgeHTML 版本号后半部分匹配的 webdriver 版本(根本不明显).
  3. 点击安装按钮.一切都将自动在您的项目中配置,因此您可以自动开始使用驱动程序

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

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/'

The FirefoxDriver and ChromeDriver work just fine.

This is an issue with the driver?

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

C:WINDOWSsystem32>netstat -a -o | find "20548"

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

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

解决方案

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/en-us/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. By downloading it from the Microsoft developer website
  2. Find it in the visual studio NuGet manager and let the manger configure it into your project (preferred method)

Method 1: how to know which driver to download

  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

Method 2: how to know which driver to download

  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).
  3. Click in install button. everything will automatically be configured in your project so you can automatically start using the driver

  4. 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/上启动驱动程序服务'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:OpenQA.Selenium.WebDriverException: '无法在 http://localhost:20548/上启动驱动程序服务'

基础教程推荐