Testing Web Apps With Selenium, Explorer and .NET

Here are the steps to run your Selenium tests against Internet Explorer.

Create the tests

  1. Install Selenium IDE from http://seleniumhq.org
  2. Record your tests in Firefox using the Selenium IDE
    image
  3. Click File > Create New Test
  4. Click the record button and create your test
  5. Click the record button to stop the test
  6. Save your test
  7. Click Options > Format > C# to get the C# code
    image

Setup Selenium Remote Control (RC)

  1. Download Selenium RC (it includes the server and all necessary files)
  2. Start the server by running selenium-server.jar in the selenium-server folder
    1. You can double click it, or
    2. Open a command prompt and type:
      java -jar selenium-server.jar

Run the tests

  1. Create a new class library project in Visual Studio.
  2. Reference the assemblies in the selenium RC folder related to .net
  3. Paste the generated code from step #7 above into a class file
  4. To test Internet Explorer, change the setup method to this
  5. Run the tests with your favorite Runner – I use ReSharper

A Selenium Core window opens up as well as an IE window and your tests will run.

image

Jeremy blogged something very similar to this at http://codebetter.com/blogs/jeremy.miller/archive/2006/05/14/144666.aspx