As you might know, one of the best available frameworks for creating web automation tests is Selenium WebDriver. Microsoft publicly announced that their new Windows 10 web browser- Edge is going to support WebDriver automation (Microsoft Edge WebDriver). Of course I wanted to try it as fast as I can, so I prepared everything needed and created several tests. I’m going to present to you their source code and results.

Create Your First WebDriver Test Project

1. Create New Test Project in Visual Studio.

2. Install NuGet package manager and navigate to it.

3. Search for Selenium and install the first item in the result list

4. Search and install Selenium.Firefox.WebDriver. Through this package you will be able to run tests in Firefox.

While ago when we were working on the first version of the BELLATRIX test automation framework, I did this research while I was working on the Edge integration in the solution.

Microsoft Edge WebDriver C# Code

Test’s Test Case

The primary goal of the below tests is going to be to create a “healthy” diet menu from specially designed by me- diet generator page.

Code Examples in Firefox WebDriver

The automation of the above form using Firefox WebDriver is a trivial task.

When the object is created for the first time, all elements are initialized through the WebDriver’s PageFactory.

The code of the test is almost identical with the only difference that the elements initializations are now a responsibility of the page object.

The execution time almost didn’t change- ~15 seconds. Anyway, it was a little bit faster.

Microsoft Edge WebDriver Prerequisites

1. Download Microsoft Edge WebDriver executable from the official Microsoft website.

2. Install Microsoft Edge WebDriver from the previously downloaded setup.

3. Create a virtual machine or upgrade your OS to Windows 10, the Microsoft Edge WebDriver is compatible only with it.

4. Install Selenium.Microsoft.Webdriver2 NuGet package to your project.

Code Examples in Microsoft Edge WebDriver

On theory, the same tests should be able to be executed through the new WebDriver, only with the exchange of the driver type. The setup for the Microsoft Edge WebDriver is a little bit more complicated. Configure Copy Always to true for the MicrosoftWebDriver.exe file. Then we set the constructor of EdgeDriver to search for the driver in the currently executing folder.

The same test executed with Firefox Driver finished for 16 seconds; now it was run for 4 seconds using the new Microsoft Edge WebDriver.

The page object implementation was even faster. The test execution took only 3 seconds.