Adding using statements

As well as adding a reference to the project for Selenium WebDriver and NUnit, you must also add a “using” statement for the sections you are going to use in your test. A good start is to add the following using statements to your file:

using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using NUnit.Framework;

Note: If you have more than one CS file in your project, you will need a using statement(s) for each file as required.

This may seem as common sense to the more seasoned programmer but for those starting off at the beginning it is a useful reminder. In the example above I have added a using statement for the standard Selenium WebDriver and NUnit classes and also for the Firefox browser. There are many other possibilities, but I will cover those as we need them.

This screenshot shows where the using statements are usually placed in a C# file:
Using Statements

Leave a Comment