简体   繁体   English

是否有适用于 Microsoft Edge 浏览器的 Selenium WebDriver?

[英]Is there a Selenium WebDriver available for the Microsoft Edge browser?

As of the date of this post the name "Microsoft Edge" has just been officially announced as the default browser for the new Windows 10.截至本文发布之日,名称“Microsoft Edge”刚刚正式宣布为新 Windows 10 的默认浏览器。

It may be premature to ask but I would like to know if a new Selenium WebDriver is available for it and if not, if there is any telling how long we might expect to wait until we see one developed?现在问可能还为时过早,但我想知道是否有新的 Selenium WebDriver 可用,如果没有,是否有任何迹象表明我们可以等待多久才能看到开发出来?

(A technical preview of Windows 10 has already been out so this doesn't seem like a foolish question to me.) (Windows 10 的技术预览版已经发布,所以这对我来说似乎不是一个愚蠢的问题。)

Yes, there is a WebDriver implementation for Microsoft Edge.是的,Microsoft Edge 有一个 WebDriver 实现。 Its initial availability was announced on 23 July 2015 .其最初的可用性于2015 年 7 月 23 日宣布 Language bindings in the Selenium open source project have been updated to take advantage of this driver implementation, and those updates have been released in Selenium 2.47. Selenium 开源项目中的语言绑定已更新以利用此驱动程序实现,并且这些更新已在 Selenium 2.47 中发布。 Note that the Java language bindings were re-released as 2.47.1 to correct an initial issue.请注意,Java 语言绑定已作为 2.47.1 重新发布以更正最初的问题。 The initial implementation has limited functionality , but Microsoft is committed to bringing a fully functional driver implementation to fruition, so updates will be forthcoming.初始实现的功能有限,但Microsoft 致力于实现功能齐全的驱动程序实现,因此即将进行更新。

Microsoft has provided MicrosoftWebDriver which can be used for Edge browser. Microsoft 提供了 MicrosoftWebDriver,可用于 Edge 浏览器。

  1. Correct version of MicrosoftWebDriver needs to be downloaded, based on the OS Build number需要根据操作系统版本号下载正确版本的 MicrosoftWebDriver

  2. Go to Start > Settings > System > About and note down the OS Build number.转到“开始”>“设置”>“系统”>“关于”并记下操作系统内部版本号。

  3. Download the proper version of the driver from this link - https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/从此链接下载正确版本的驱动程序 - https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/

  4. If the file that's downloaded is .msi, then install it to get the .exe driver.如果下载的文件是 .msi,则安装它以获取 .exe 驱动程序。 For one of the release, direct .exe can be downloaded.对于其中一个发行版,可以直接下载.exe。

  5. Once the MicrosoftWebDriver.exe is downloaded, we can use it in our test script using either System.setProperty("webdriver.edge.driver", "driver location") or using environment variable下载 MicrosoftWebDriver.exe 后,我们可以使用 System.setProperty("webdriver.edge.driver", "driver location") 或使用环境变量在我们的测试脚本中使用它

The sample script would be like this -示例脚本将是这样的 -

System.setProperty("webdriver.edge.driver","C:\\Program Files (x86)\\Microsoft Web Driver\\MicrosoftWebDriver.exe"); //put actual location
WebDriver driver = new EdgeDriver();
driver.get("your link");

Refer this article for detailed information - http://automationtestinghub.com/selenium-3-launch-microsoft-edge-with-microsoftwebdriver/有关详细信息,请参阅本文 - http://automationtestinghub.com/selenium-3-launch-microsoft-edge-with-microsoftwebdriver/

The Microsoft Edge driver for Selenium can be automatically downloaded (for Java) using the library webdrivermanager as follows:可以使用库webdrivermanager自动下载SeleniumMicrosoft Edge 驱动程序(适用于 Java),如下所示:

EdgeDriverManager.getInstance().setup();

The variable webdriver.edge.driver is also exported by webdrivermanager with the proper path of MicrosoftWebDriver.exe .变量webdriver.edge.driver也由 webdrivermanager 导出,并带有MicrosoftWebDriver.exe的正确路径。

"in case it wasn't clear, Microsoft Edge will have WebDriver support. It isn't available today, but is in development Q's? #msedgesummit" tweet from John Jansen the who is - "Microsoft Engineer. Principal Software Engineer (nee Test) Lead on Project Spartan (nee Internet Explorer)." “如果不清楚,Microsoft Edge 将提供 WebDriver 支持。它今天不可用,但正在开发 Q 中?#msedgesummit”来自 John Jansen 的推文是谁 - “微软工程师。首席软件工程师(nee Test ) 领导斯巴达计划 (nee Internet Explorer)。” You can find him on twitter @thejohnjansen and wait for an announcement :)你可以在 twitter @thejohnjansen 上找到他,然后等待公告:)

Prerequisite: Windows 10 is installed on your machine先决条件:您的计算机上已安装 Windows 10

  1. Download the specified Microsoft WebDriver server version for your build (In my case it is MicrosoftWebDriver.exe for the Operating System: Windows 10 Pro 64-bit (10.0, Build 14393))为您的构建下载指定的 Microsoft WebDriver 服务器版本(在我的情况下,它是用于操作系统的 MicrosoftWebDriver.exe:Windows 10 Pro 64-bit (10.0, Build 14393))
  2. Selenium WD Java code for MS Edge is as follows: MS Edge的Selenium WD Java代码如下:

    System.setProperty("webdriver.edge.driver", "D:\\Ripon\\MicrosoftWebDriver.exe"); System.setProperty("webdriver.edge.driver", "D:\\Ripon\\MicrosoftWebDriver.exe");
    driver = new EdgeDriver();驱动程序 = 新 EdgeDriver();

As of EdgeHTML version 18 (which arrived with Windows version 1809), there is no longer a standalone driver download.从 EdgeHTML 版本 18(随 Windows 版本 1809 一起提供)开始,不再提供独立的驱动程序下载。 You can obtain the new driver in one of two ways:您可以通过以下两种方式之一获取新驱动程序:

  • Start - type "Manage optional features" - Click "Add a Feature" - Find "WebDriver"开始——输入“管理可选功能”——点击“添加功能”——找到“WebDriver”
  • Entering the following on an elevated command prompt - "DISM.exe /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~0.0.1.0"在提升的命令提示符下输入以下内容 - “DISM.exe /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~0.0.1.0”

https://blogs.windows.com/msedgedev/2018/06/14/webdriver-w3c-recommendation-feature-on-demand/#Qj75uxuFHccPmCW5.97 https://blogs.windows.com/msedgedev/2018/06/14/webdriver-w3c-recommendation-feature-on-demand/#Qj75uxuFHccPmCW5.97

Legacy versions are still available from: https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/旧版本仍可从以下网址获得: https : //developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/

Update: It appears that version 18 is now legacy and we are back to installing a separate webdriver since the move to Chromium.更新:似乎 18 版现在是旧版,自从迁移到 Chromium 后,我们又重新安装了单独的 webdriver。 The link directly above this will still take you to the correct drivers page.直接在此上方的链接仍会将您带到正确的驱动程序页面。

Thanks for your help, I was blocked with my tests, searching for a "EdgeDriver.exe" asked by the selenium EdgeDriver implementation and only find the MicrosoftWebDriver.感谢您的帮助,我的测试被阻止,搜索 selenium EdgeDriver 实现询问的“EdgeDriver.exe”,但只找到了 MicrosoftWebDriver。

I have made this in C# if this can help someone, based on your previous answers :如果这可以帮助某人,我已经在 C# 中做了这个,根据你以前的回答:

First, you need to download the MicrosoftWebDriver nuget package, this one will only make a copy of the MicrosoftWebDriver.exe into your destination folder on compilation then首先,您需要下载 MicrosoftWebDriver nuget 软件包,此软件包只会在编译时将 MicrosoftWebDriver.exe 复制到您的目标文件夹中,然后

private readonly string _localDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

Environment.SetEnvironmentVariable("webdriver.edge.driver", _localDir + "MicrosoftWebDriver.exe");
var driver = new EdgeDriver();

Hope this can help someone.希望这可以帮助某人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 适用于最新 selenium webdriver 的兼容 Microsoft EDGE 版本 - Compatible Microsoft EDGE version for latest selenium webdriver MoveMouseAction在Microsoft WebDriver中不起作用(对于Edge浏览器) - MoveMouseAction is not working in Microsoft WebDriver (for Edge browser) 在Microsoft Edge浏览器中使用Selenium网格的问题 - Issue using Selenium grid with Microsoft Edge browser 使用 selenium 启动 Microsoft Edge Chromium 浏览器 - Launch Microsoft Edge Chromium browser using selenium 无法在 Selenium 3 中启动 Microsoft Edge 浏览器 - Not able to launch Microsoft Edge Browser in Selenium 3 如何使用 Selenium WebDriver 和 Java 在 InPrivate 中启动 Microsoft Edge - How to launch Microsoft Edge in InPrivate with Selenium WebDriver and Java 如何使用 Selenium webdriver-js 使用 Edge 浏览器 - How to work with Edge browser using Selenium webdriver-js 将最新的 Microsoft Edge (Win10) 浏览器添加到 Selenium 网格 - Add latest Microsoft Edge (Win10) browser to Selenium Grid 用于 Microsoft Edge 的 Dockerized webdriver 测试 - Dockerized webdriver testing for Microsoft Edge 使用“new EdgeOptions()”优于“DesiredCapabilities.edge()”错误通过Jenkins和Selenium启动远程Microsoft Edge浏览器 - Using `new EdgeOptions()` is preferred to `DesiredCapabilities.edge()` error launching Remote Microsoft Edge browser through Jenkins and Selenium
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM