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.

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 | Value=”C:UsersJTPDownloadsmicrosoft edge driverMicrosoftWebDriver.exe' |
Sample code for the system property:
Microsoft Edge Selenium Ide
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.
| Steps | Actions | Input | Excepted 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 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 | packagetestpackage; import org.openqa.selenium.WebDriver; publicclasstest_edge{ publicstaticvoidmain(String[]args)throwsInterruptedException{ System.setProperty('webdriver.edge.driver','C:UsersJTPDownloadsmicrosoft edge driverMicrosoftWebDriver.exe'); WebDriver driver=newEdgeDriver(); driver.get('https://twitter.com/login?lang=en'); // Step3: Pass the value in the username text box. driver.findElement(By.xpath('//input[@placeholder='Phone, email or username']1]')).sendKeys('admin'); System.out.println('user name entered successfully'); // Step4: Pass the value in the password text box. driver.findElement(By.xpath('//div[@class='clearfixfield']//input Thread.sleep(2000); System.out.println('password entered successfully '); driver.findElement(By.className('clearfix')).click(); // Step6: Capture the title of the home page. Stringact_title=driver.getTitle(); if(exp_title.equals(act_title)) System.out.println('test passed'); else{ } driver.close(); } |
- Now, right-click on the Eclipse code and select Run as → Java Application.
- The output of the above test script would be displayed in the Microsoft Edge browser.
- The output of all print commandof the above test script would be displayed in the Eclipse console window.
Microsoft Edge Selenium Webdriver Python
This blog follows on from the previous blog about how to set up Selenium Grid for WebDriver or for Ranorex Web Testing.
These instructions show you how to also include the Microsoft Edge Browser in your established Grid running on a Windows local host machine.
Step 1 – Download MicrosoftWebDriver
The first step is to download the Microsoft Web Driver Server paying particular note of the correct version to download depending on you exact O/S version. From:
Extract the executable to the same directory as your other WebDriver Browser Servers.
Step 2 – Start the Selenium Server
Now start the Selenium Server, just as we did in the last post. Just running on the local host.
2 4 | java-Dwebdriver.edge.driver='C:UsersedgewordsDocumentsSelServerMicrosoftWebDriver.exe'-jar selenium-server-standalone-3.3.1.jar-port5556 -role node-hub http://localhost:4444/grid/register -browser 'browserName=MicrosoftEdge, platform=WINDOWS, maxInstances=10' |
Microsoft Edge Selenium Webdriver
Note, the port number I have used here is 5556. Also note that the command line above that starts with ‘java’ is over two lines, but is one line of code.
Step 5 – Open the Grid Console to check the available Nodes
Microsoft Edge Selenium Grid
Now we should have the Grid running with two Nodes. One Node on port 5555 for our default browsers, and a second on port 5556 for our Edge Browsers.
Open the Grid console, by opening a browser on the Selenium Server, and going to: http://localhost:4444/grid/console You should see:
