Skip to main content

Launch Microsoft Edge browser using Selenium with Java

Microsoft Edge is a cross-platform web browser developed by Microsoft. First make sure that Microsoft Edge browser is already installed on your system. To launch Microsoft Edge browser using Selenium follow below steps:

Step 1: Check you Edge Browser version. By clicking on ... (3 dots on top right corner of browser) then Settings -> About Microsoft Edge

Step 2: Open this link or Search in google microsoft edge webdriver and download the version compatible with your browser and operating system. 

Step 3: Unzip the file and paste driver to your desired directory.

Step 4: Now open your driver configuration file and paste following code. Since we have not introduced TestNG or JUnit yet, we will be executing this with Java runner using main class.

package com.pb.sel.seltest;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.edge.EdgeDriver;

public class App 
	public static void main(String args[])
		System.setProperty("webdriver.edge.driver",System.getProperty("user.dir") + "//drivers//msedgedriver.exe");
		WebDriver driver;
		driver = new EdgeDriver();

In above code,

  • setProperty will set the system property to value webdriver.edge.driver and the path is given to get the msedge driver.
  • Here WebDriver is the main interface and all the methods which are declared in Webdriver interface are implemented by respective driver class.
  • new EdgeDriver(), Here we are creating instance of EdgeDriver class.
  • driver.get() is used to navigate to given url.
Submitted by ksharma on September 28, 2020


At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.