1

如何在 Selenium 中运行 Microsoft Edge。每次我运行测试时,Edge 浏览器都会打开,但不会加载任何 URL。然后它会显示一个带有文本的小对话框:

Microsoft Web Driver has stopped working. A problem cause the program to stop working correctly. Please close the program

我在用:

  • Windows 10 操作系统 17763.914
  • Selenium.WebDriver.MicrosoftDriver 版本 17.17134.0
  • Selenium 支持版本 3.141.0
  • Selenium Web 驱动程序版本 3.141.0 和
  • Microsoft Edge 浏览器版本 18.17763。
  • 它是带有 C# 的 N 单元框架。

代码试用:

using OpenQA.Selenium.Edge;
driver = new EdgeDriver();
4

1 回答 1

1

此错误消息...

Microsoft Web Driver has stopped working. A problem cause the program to stop working correctly. Please close the program

...意味着MicrosoftWebDriver无法启动/产生新的浏览上下文,即Microsoft Edge 浏览器会话。


在您使用Microsoft Edge Browser Version 18.17763时,根据使用新的 WebDriver 功能、W3C 协议支持和自动更新增强 Microsoft Edge 中的自动化测试中的文档,现在 MicrosoftWebDriver 是Windows Feature on Demand (FoD),可确保它始终自动更新,并启用了一些获取 Microsoft WebDriver 的新方法。

脚步

  • 启用将安装适当版本的 WebDriver 的开发人员模式。

    Open Settings app > Go to Update & Security > For Developer and then select "Developer Mode".
    
  • 您还可以通过以下两种方式之一安装独立版本的 WebDriver:

    • 从开始搜索“管理可选功能”,然后选择“添加功能”、“WebDriver”。
    • 通过在提升的命令提示符下运行以下命令来通过 DISM 安装:

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

注意:通过命令安装MicrosoftWebDriverDISM时,默认情况下 webdriver 安装在以下子目录中:

  • 64位:

    C:\\Windows\\SysWOW64\\MicrosoftWebDriver.exe
    
  • 32位:

    C:\\Windows\\System32\\MicrosoftWebDriver.exe
    

tl; 博士

根据Microsoft Edge 开发人员指南

EdgeHTML 18 包括 Microsoft Edge 平台的当前版本中提供的以下新功能和更新功能,截至2018 年 10 月 10 日的 Windows 更新(10/2018,内部版本 17763)。有关特定Windows Insider Preview 版本的更改,请参阅Microsoft Edge 更改日志EdgeHTML 中的新增功能

于 2019-12-24T21:43:35.300 回答