Unable to launch Edge browser using Selenium Web driver on Microsoft Windows

  • Given any web application, we are unable to run the selenium scripts on Edge browser for Microsoft Windows OS Build 18362 or higher.
  • You may also face exception “org.openqa.selenium.WebDriverException: Unable to parse remote response“.
  • Moreover, automation testers/developers may unable to launch edge browser for running selenium scripts.
  • Firstly try to locate the Pre-installed edge driver on the system , Edge driver can be found at these below mentioned locations:
    • C:\\Windows\\System32\\MicrosoftWebDriver.exe
    • C:\\Windows\\SysWOW64\\MicrosoftWebDriver.exe
    • C:\\Windows\\WinSxS\\amd64_microsoft-webdriver-server-components_31bf3856ad364e35_10.0.18362.1_none_c52dd23839475f5b\\MicrosoftWebDriver.exe
    • C:\\Windows\\WinSxS\\wow64_microsoft-webdriver-server-components_31bf3856ad364e35_10.0.18362.1_none_cf827c8a6da82156\\MicrosoftWebDriver.exe
  • Now try to launch the Edge browser using below code :
package org.learn;

package TestCases;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.edge.EdgeDriver;
public class MakeinJavaTest {

    public static void main(String[] args) { 

          //String edgeDriver = "C:\\Windows\\SysWOW64\\MicrosoftWebDriver.exe"; 
         //String edgeDriverPath = "C:\\Windows\\WinSxS\\amd64_microsoft-webdriver-server-components_31bf3856ad364e35_10.0.18362.1_none_c52dd23839475f5b\\MicrosoftWebDriver.exe";
         //String edgeDriverPath = "C:\\Windows\\System32\\MicrosoftWebDriver.exe";
         //String edgeDriverPath = "C:\\Windows\\SysWOW64\\MicrosoftWebDriver.exe";

         String edgeDriver = "C:\\Windows\\System32\\MicrosoftWebDriver.exe";

         System.setProperty("webdriver.edge.driver", edgeDriver); 
         WebDriver driver = new EdgeDriver();

         driver.get("https://www.google.com");
     }    
}
  • In case error still persists, then it can be the issue of OS build version.
  • Enable Developer Mode which will install the appropriate version of WebDriver — Open Settings app > Go to Update & Security > For Developer and then select “Developer Mode”.
  • To find your OS build version — launch the command prompt , type winver and press OK. A pop up displaying your OS build number will be displayed.
  • Now go to official website of Microsoft and try to download the edge driver corresponding to the matching OS build number  https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
  • If unable to find the matching build number, run the command prompt as administrator and execute command :                                                                                                                                                                   “DISM.exe /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~0.0.1.0”.
  • Now try to run the above mentioned code again for launching the edge driver.

Still unable to launch the edge  browser ? We have another solution for solving this problem:

  • To find your correct build number: Launch Microsoft Edge. Open the Settings and more (…) menu, choose Help and feedback, and then choose About Microsoft Edge. Having the correct version of WebDriver for your build ensures it runs correctly.
  • Download the correct version of edge driver and place this driver at specified location (“C:\\msedgedriver.exe”).
  • Use the below code snippet for running the scripts on Edge browser:
package org.learn;

package TestCases;
import java.util.Collections;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.edge.EdgeOptions;
public class MakeinJavaTest {

    public static void main(String[] args) throws InterruptedException { 

     System.setProperty("webdriver.edge.driver","C:\\msedgedriver.exe");
    EdgeOptions edgeOptions = new EdgeOptions(); 
    edgeOptions.setBinary("C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe"); 
    edgeOptions.setExperimentalOption("useAutomationExtension", false);
    edgeOptions.setExperimentalOption("excludeSwitches",Collections.singletonList("enable-automation")); 
    EdgeDriver webDriver = new EdgeDriver(edgeOptions); 
    webDriver.manage().window().maximize();
    Thread.sleep(20000);
    webDriver.manage().timeouts().implicitlyWait(70, TimeUnit.SECONDS);

         //replace the URL of the web page here..
         webDriver.get("https://www.google.com");
         
    }    
}

 

Scroll to Top