Step by Step Procedure for executing Selenium Test automation in Microsoft Edge

 In Testing

microsoft-edge-selenium

Microsoft Edge:

Microsoft Edge is designed to be a lightweight web browser with a layout engine built around web standards, removing support for legacy technologies such as ActiveX in favour of extensions and integration with other Microsoft services, such as the digital assistant Cortana and OneDrive; it also includes annotation tools and a reading mode

Microsoft Edge replaces Internet Explorer, which was used as the default browser since Windows ‘95 release, as the default browser on Windows 10. It will also be the default browser of the forthcoming release of Windows 10 for smartphones and small tablets

Microsoft Edge, initially developed under the codename Project Spartan, is a web browser developed by Microsoft and included in the Microsoft Windows operating system. Officially released on July 29, 2015 for Windows 10.

Selenium Web Driver

WebDriver is a web automation framework that allows you to execute your tests against different browsers like Firefox, Internet explorer, Google Chrome, etc.

WebDriver also enables you to use different programming language in creating your test scripts. Following programming languages are supported by WebDriver.

Java, .Net, PHP, Python, Perl and Ruby.

Step-1: Get started with Microsoft Edge WebDriver

To get started using WebDriver, we need to have first Microsoft Edge driver installed in our Windows 10 operating system to start with new automation framework. To download the Microsoft WebDriver Server. Click here Click here

Step-2: Identify the right driver version for your build

To find your correct build number: Go to Start > Settings > System > About and locate the number next to OS Build on the screen. This is your build number. Having the correct version of WebDriver for your build ensures it runs correctly.

Build will be displayed like below image. You can download your system’s build.

downloads-img

Step-4: Setup driver in Selenium automation project

Copy and paste the driver file into your project. Ex: The picture below shows the project created in Eclipse using Java. You can also use any editing tool and any language like C#.

microsoft-web-driver

Step-5: Develop code to execute your test in Microsoft Edge

Here is the code snippet


 package WebDriver2;

 import org.openqa.selenium.By;

 import org.openqa.selenium.WebDriver;

 import org.openqa.selenium.WebElement;

 import org.openqa.selenium.edge.EdgeDriver;
//To use Edge browser import the Edge driver to your code

 import org.openqa.selenium.support.ui.Select;

 import org.testng.annotations.BeforeMethod;

 import org.testng.annotations.Test;

 

public class Class3 {

 public static WebDriver dr;

 @BeforeMethod

 public static void start() //Setting the system property globally

 {

 System.setProperty("webdriver.edge.driver", "./MicrosoftWebDriver.exe");

 dr = new EdgeDriver();

 dr.get("your URL");

 dr.manage().window().maximize();

 

}

 

@Test

 public static void TC1()

 {

 

 //Add your Test script here

 

 }
 }

Step-6: Execute your Selenium test in Microsoft Edge

Enter application URL in Microsoft Edge Browser. Execution will fail with an error like


“No such element (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 141 milliseconds........”

To avoid such errors, you need to disable some setting in Edge browser. To do that go to
Open Browser -> Settings -> View advanced settings
Disable all the below shown settings.

op-taskbar-img

Now run your test script again. ☺ which will pass.

Recent Posts
Showing 8 comments
  • Srividhya
    Reply

    Hi, I am also facing the same issue. But I am unable to find the settings “op-taskbar-img” in Advanced Settings.
    Can you help me with the sceenshots or steps to identify the settings

    • Ganesh
      Reply

      Hi, There are two Advanced Settings under Settings menu, one is kept for below “Account” as a hyperlink (You might have clicked that). You need to Scroll down little and click on View advance settings button, which will open the settings page and scrolling down you can see the options.

  • Michael Wade
    Reply

    Hi,
    Thanks for putting together this step approach….on similar lines you might like to check out this post as well… Integrating Selenium with Google Drive…http://www.cigniti.com/blog/integrating-selenium-with-google-drive-2/

  • satish
    Reply

    hi all,
    i am facing one issue ..previously i am running test cases on Chrome ..then i shifted to Edge browser but in Edge browser it is not clicking on some controls ..but Xpath is right …what i can do to resolved this issue

    • Ganesh
      Reply

      You may have to Open Browser -> Settings -> View advanced settings
      Disable few settings as shown above. Then try.

  • Sai
    Reply

    The post is very helpful and solved the issue I was having on edge. But came up with a new issue ‘Element is obscured (WARNING: The server did not provide any stacktrace information)’ Can anyone help me with this issue

    • Ganesh
      Reply

      Instead of using webElement.click() you can ‘perform’.

      Actions actions = new Actions(webDriver);
      actions.click(webElement).perform();

      Hope this will help you.

  • Ganesh
    Reply

    Cool, Thanks for sharing. 🙂

Leave a Comment

Start typing and press Enter to search