MicrosoftWebDriver.exe should be pre-installed in an elevated command prompt

こ雲淡風輕ζ 提交于 2020-02-16 05:47:59

问题


I have microsoft edge installed on my machine with below versions:

Microsoft Edge 44.18362.449.0
Microsoft EdgeHTML 18.18363

I am trying to use webdrivermanager to run my automation test (java+selenium) on Edge by the below code:

WebDriverManager.edgedriver().setup();
            driver = new EdgeDriver();

But, it complains with the below error:

WebDriverManagerException: MicrosoftWebDriver.exe should be pre-installed in an elevated command prompt executing: dism /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~0.0.1.0
  1. Shouldn't the webdrivermanager dowbload and install it for me?
  2. How can i fix this issue?

回答1:


This error message...

WebDriverManagerException: MicrosoftWebDriver.exe should be pre-installed in an elevated command prompt executing: dism /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~0.0.1.0

...implies that the WebDriverManager won't be able to install the latest version of MicrosoftWebDriver binary in the process to initiate/spawn a new Browsing Context i.e. Microsoft Edge Browser session.


As you are using Microsoft EdgeHTML 18 as per the documentation in 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.

Steps

To configure you will have to enable Developer Mode:

Go to Settings > Update and Security > For Developer and then select "Developer mode".

To install run Microsoft Edge version 18 through an elevated command prompt:

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

Note: When installing MicrosoftWebDriver through the DISM command, by default the webdriver is installed within the following sub-directories:

  • 64 bit:

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

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

tl; dr

As per Microsoft Edge Developer Guide:

EdgeHTML 18 includes the following new and updated features shipped in the current release of the Microsoft Edge platform, as of the Windows 10 October 2018 Update (10/2018, Build 17763). For changes in specific Windows Insider Preview builds, see the Microsoft Edge Changelog and What's New in EdgeHTML.



来源:https://stackoverflow.com/questions/59447561/microsoftwebdriver-exe-should-be-pre-installed-in-an-elevated-command-prompt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!