Setting up Selenium in C#

1. Download Selenium WebDriver for C#

Go to SeleniumHG website and get into Downloads, scroll down until you see the different versions of the WebDriver and get the C# version.
Extract the zip files into a folder.

Create a project

Create a Test Project using VS (File > New > Project > Test > Unit Test).
Add the WebDriver libraries: References > Right click > Add Reference… > Browse > Take the right ones for your framework (35 or 40).

Note: You can create a different type of project, like a Console App, but this other allows you to get test reports, config different suites of tests, etc.

Start testing

Now you can start testing, include the namespaces inside OpenQa. For example to test in Chrome:

using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Support.UI;

Leave a Reply

Close Bitnami banner
Bitnami