Here are the steps to run your Selenium tests against Internet Explorer.
Create the tests
- Install Selenium IDE from http://seleniumhq.org
- Record your tests in Firefox using the Selenium IDE
- Click File > Create New Test
- Click the record button and create your test
- Click the record button to stop the test
- Save your test
- Click Options > Format > C# to get the C# code
Setup Selenium Remote Control (RC)
- Download Selenium RC (it includes the server and all necessary files)
- Start the server by running selenium-server.jar in the selenium-server folder
- You can double click it, or
- Open a command prompt and type:
java -jar selenium-server.jar
Run the tests
- Create a new class library project in Visual Studio.
- Reference the assemblies in the selenium RC folder related to .net
- Paste the generated code from step #7 above into a class file
- 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(); }
- 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.
Jeremy blogged something very similar to this at http://codebetter.com/blogs/jeremy.miller/archive/2006/05/14/144666.aspx
