Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
600 views
in Technique[技术] by (71.8m points)

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

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?
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...