Site icon

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

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");
     }    
}

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

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");
         
    }    
}

 

Exit mobile version