Developer Tips: C# Selenium with MSTest Basics

See the original posting on DZone Python

Selenium is a great tool for testing your user interface (UI). There are plenty of great tutorials on the web that I encourage you to review. This article is going to cover some basic setup steps and a simple .NET Core 2.1 code sample.

Browser Settings

  1. Assumptions: Chrome/Firefox (64-bit)/IE11/Edge (Win10 or higher).
  2. Most of these settings have to be done for IE11 as the modern browsers do this by default or the alternative usually still works.
    • Always open pop-ups in a new tab.
    • Turn off pop-up blockers.
    • IE11: Enable Protected Mode for all security zones.
    • Disable save password prompts.
    • When prompted to AutoComplete, click "No".
    • Set zoom to 100%.
  3. Restart the browsers.

Windows Settings

  1. Disable the logon screen save while you’re sitting back watching your automated tests run the screen saver does not kick on ruining your test.
  2. Restart the computer.

Set the WebDrivers

  1. IE 11.
  2. 64 bit should also work, but some consultants I worked with recommended the 32 bit over 64 bit as of 12/2018.
    • Extract "IEDriverServer.exe" from the zip to c:\Selenium.WebDrivers
  3. Microsoft Edge (EdgeHtml).
    • Edge version 18 or great, then run the following in command prompt as an administrator.
      • DISM.exe /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~
      • Edge version less than 18, then do the following.
    • Under "Downloads" > Microsoft Edge (EdgeHtml) > click the top Release.
      • Save "MicrosoftWebDriver.exe" to c:\Selenium.WebDrivers.
  4. Microsoft Edge (Chromium).
    1. Since this version is in Preview  I did not download and test but here are the steps.
    3. Under "Downloads" > Microsoft Edge (Chromium) > for the top Release click x64.
    4. Extract "msedgedriver.exe " from the zip to c:\Selenium.WebDrivers.
  5. Chrome.
    2. Under "All versions available in Downloads" next to the "Latest stable release" click the ChromeDriver link > Click ""
    3. Extract "chromedriver.exe" from the zip to c:\Selenium.WebDrivers.
  6. Firefox.
    2. Under the latest release v#.##.# under "Assets" click the geckodriver-*
    3. Extract "geckodriver.exe" from the zip to c:\Selenium.WebDrivers.

Create the Application

The full source code is in