How To Run WebDriver Test Case using Microsoft Edge Browser

Download Microsoft WebDriver from here to launch Edge Browser. Download the proper version of the driver based on your OS build number. If the extension of the downloaded file is “.msi“, you need to install it to get the “.exe” driver.

Test Case:

1)Open Web Browser.
2)Open URL
3)Enter username  (Admin).
4)Enter password  (admin).   
5)Click on Login.
6)Capture title of the home page.
7)Verify title of the page: OrangeHRM 

8) close browser

WebDriver script:

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

public class EdgeBrowserTest {

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

// step1
System.setProperty("webdriver.edge.driver", "C:/Drivers/MicrosoftEdgeDriver/MicrosoftWebDriver.exe");
WebDriver driver = new EdgeDriver();

// step2

// step3

// step4

// step5


String exp_title = "OrangeHRM";
String act_title = driver.getTitle(); // step6

if (exp_title.equals(act_title)) {     //step7
System.out.println(" test case passed");
} else {
System.out.println(" test case failed");
driver.close(); //step8