Who Is This For?
Introduction
Driver Object
Page
Headers, Footers, and Sidebars
Tests
A Simple Test Script
Who Is This For?
Introduction
Driver Object

· ChromeDriver.exe
· IEDriverServer.exe
Both of which can be found on Nuget.
Pages
Pages are an essential part of the automation script. It holds the address of the page that extends from the base URL in the Driver Object as well as locators for each of the elements on the page. Sometimes it is best to encapsulate the services that a page offers (log in, register a new user, create a customer, process an order, and any of a long list of complicated steps that are intended uses of a web page) in the Page which will relate to specific use cases. As you can see at the top of Figure 4, the LoginPage inherits from a BasePage, so let’s take a look at the BasePage first. What all of the other Pages inherit are a handful of useful properties and methods that are repeated throughout the test project: pageURL, a GoTo(pageURL) method, and an IsAt bool property. When creating a new Page Object, you first override the pageURL with the URL of the specific page minus the baseURL that you declared in the Driver Object. After that, you can begin creating web elements and services. For the Login page here, I have created a LoginCommand class that accesses the web elements defined in the LoginPage to script the act of logging into the AUT. This is optional, but since most AUTs require a login to do most things, this is probably the safest route to go. It also makes your login test look really simple. |
Headers, Footers, and Sidebars

Create an object that does not inherit the BasePage class.
This Header Object does not have a pageURL or need the IsAt property because it’s not a page. It contains nearly 20 elements that repeat on almost every single page in the system. Repeating these elements in every page would quickly yield hundreds of lines of repeated code very quickly.
TestsA test script begins with a BaseTest class. In the base class, we establish our ContextInstance which will help us gather results. Most importantly in the Init() method we initialize our driver. Here, it is hard coded for Internet Explorer; however, if we use data driven testing, this can be made to run in multiple browsers. It's pretty clear to see that we're getting into an area that has a lot of room for different implementations. This is just one. | Soapbox Automating test cases is an objective that contains a major assumption: test cases exist. Before you can automate anything, a manual test case must have been, at the ver y least, written. Developing automation is expensive. Doing exploratory development of automation of a system in development is expensive and potentially wasteful. Ideally, UI automation is a process of automating successfully executed test cases, so that manual testers are not wastefully repeating tests for the sole purpose of making sure they still pass. |
A Simple Test Script
In this case, the manual script would look like:
and so on... |