Microsoft Edge Selenium



Selenium WebDriver- Microsoft Edge Browser:

An updated EdgeDriver implementation for Selenium 3 with newly-added support for Microsoft Edge (Chromium). microsoft/edge-selenium-tools. In this video, we will discuss how to run or execute the Selenium webdriver script or test in Microsoft Edge Browser. We need Microsoft Edge Driver in order. The Microsoft Edge team recommends Selenium 4.00-alpha07 or later, because it supports Microsoft Edge (Chromium). However, you may control Microsoft Edge (Chromium) in all older versions of Selenium, including the current stable Selenium 3 release.

In this tutorial, we will learn how to launch the Microsoft Edge browser in the Selenium WebDriver.

Before we start automating our test scriptwith Microsoft Edge browser using Selenium, we need to make sure that,

  • We should have Windows-10installed in our machine.
  • After that, download theMicrosoft WebDriver server version for your OS builds.
  • And try to use the latestversion of Selenium (version 3.0 and above).

We will create this test case in the sametest suite (new_test), which wecreated in the previous tutorial.

Step1:

  • Firstly, right-click on the src folder and create a new Class Filefrom New ? Class.
  • And Give your Class name as Test_edge and click onthe Finish button.

Step2:

  • Firstly, we have to check the version of our OS builds. Based on our OS version build, we have to download the Edge driver.
  • And then go to Start ? Settings ? about this app to move to the Edge browser.
  • The settings window would be displayed, in the below screenshot.
  • Remember the release numberwritten next to OS Build. In this case, it is 15063, as shown in the above image.

Step3:

  • Now, go to the Selenium community,and download the Edge driver server.
  • In the Selenium community, findthe third party driver division, and click on the Microsoft edge driver linkwhich is shown in the below image,

Or

Directly open the below link, it willnavigate you to the download page of Microsoft Edge driver in your browser.

  • Move your cursor downwardlittle bit till you see the Downloads section.
  • And download the one whichmatches your build number.
  • In this case, we will click on Release15063 and download it.

Step4:

  • Then, download the zip fileinto our local system, and unzip the folder, it will generate MicrosoftWebDriver.exe fileautomatically.
Windows

Step5:

  • Run the server before launchingthe Edge browser, with the help of

System.property.

Syntax:

2
System.SetProperty(key,value);

To set the system property forMicrosoftWebDriver where

2
Key=webdriver.edge.driver

And the path of your MicrosoftWebDriver.exefile to invoke the MicrosoftWebDriver class.

2
4
6
// System Property for Edge Driver
System.setProperty('webdriver.edge.driver','C:UsersJTPDownloadsmicrosoft edge riverMicrosoftWebDriver.exe');
WebDriverdriver=newEdgeDriver();

Let us see one sample test case, where wewill try to automate the following scenarios in the Microsoft Edge browser.

StepsActionsInputExcepted Result
1. Open the Microsoft Edge browser. The Microsoft Edge browser should be opened.
2. Navigate to the URL https://twitter.com/login?lang=en The twitter login page must be displayed.
3. Pass the value in the username text box. Username=admin Username value should be entered.
4. Pass the value in the password text box. Password=admin Password value should be entered.
5. Click on the login button. The login button should be clicked.
6. Capture the title of the home page. The title of the home page should be captured.
7. Verify the title of the home page. The title of the home page should be verified.
8. Close the browser. The browser should be closed.

Here, the sample code for the above example:

2
java-jar selenium-server-standalone-3.3.1.jar-role hub

Microsoft Edge Selenium Tutorial

Step 3 – Add a default Node

Add a default node to the grid, just as we did in the last post.

cd C:UsersedgewordsDocumentsSelServer
java -jar selenium-server-standalone-3.3.1.jar -role node -hub http://localhost:4444/grid/register

NOTE: We have started this node on the default port which is 5555

Step 4 – Add a new Node to the Grid for Edge

Now we are going to add the Edge Browser as a node in its own right. So we add a new node to the same grid, but on a different port number to our default node from step 3.