A A
RSS

Testing Web Apps With Selenium, Explorer and .NET

Mon, Jan 19, 2009

Testing

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
    [SetUp]
    public void SetupTest()
    {
        selenium = new DefaultSelenium("localhost", 4444, "*iexplore",
                                        "http://www.mywebsite.com/");
        selenium.Start();
        verificationErrors = new StringBuilder();
    }
  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

Tags: , ,

  • bathang
    A succinct article.
  • bathang
    This is very useful, an article succinct
  • hai
    I do as your guide, however, my Sharpdeveloper response that "project is configured as dll and no execution command is specified." Pls help me, tks a lot.
    haiintel
blog comments powered by Disqus
Advertise Here
The Most Intelligent Add-In To Visual Studio Happy fan of

What I'm Doing...

Yonkly Open Source

Sign up for my newsletter




* = required field

powered by MailChimp!

megree Widget

Apparently, I am connected to Obama. Check this out...
My path to Obama

Cyber Identity