Monday, February 22, 2010

Selenium Two Tutorial using C#/NUnit and InternetExplorerDriver

With the hard work for Selenium 2 going on I thought that I would start creating new tutorials to get people used to the idea of using Selenium 2 and have a few examples as well. This tutorial will tell you how to set up your first test using the Selenium-WebDriver code. NOTE: This tutorial requires that you have some programming knowledge and will be able to read the code below.

You will need to download NUnit and at least Visual Studio Express c# edition to complete this tutorial. They are free to download and use. You will also need to download the .NET Bindings from Google Code

This tutorial will not be using the Remote Driver and it will be using the InternetExplorerDriver as this is the only complete browser at the moment that doesn't need to be built from the Repository.

  1. In Visual Studio lets create a new project. You will have to create a new class library by going New> New Solution> Class Library and call it Selenium.Two.Example
  2. Add a reference to the NUnit Framework by right-clicking on the solution and clicking add reference. Click on the browse tab and navigate to <%nunithome%>\bin and select nunit.framework.dll . This allows you now to create your first NUnit test.
  3. Add a reference to the WebDriver.Common.dll and WebDriver.IE.dll as well as they are needed to driver the browser.
  4. We now need to get main part of Selenium-WebDriver added to the project. Do this by right-clicking on the Solution doing Add > Existing Item and select InternetExplorerDriver.dll that correspondes with the system architecture that you will be using. E.g. If you have a 64-bit version of Windows use the x64 version of InternetExplorerDriver.dll, if you have 32-bit version of Windows use the Win32 version.

Read more: www.theautomatedtester.co.uk

Posted via email from jasper22's posterous