Selenium HTML-Testrunner framework with 2.0rc2

There are so many languages and frameworks for selenium, such as JAVA- JUnit framework, and C#- .Net. These are excellent if you are comfortable with one of the languages and tools. It will help you to create dynamic, advanced test framework according to your test need. Moreover, it opens door to use powerful development language in your test. For example if and else logic.
However, this HTML based Test Runner framework is easy and requires low maintenance. It is powerful enough for most of the automation need and you can use javaScript to make your test more meaningful if necessary. You as an automation tester do not need development language either.
Please follow these steps if you want to adopt this for your test automation purpose. I have used website Facebook log-in page for this tutorial. I am assuming you know about selenium IDE and recording the recording. If answer is ‘no’ then going to this page and come back here.

Download Selenium Server
  • Go to It is also known as Selenium Server. 
  • If you cannot   find stable build find from this page:
  • It is a .ZIP file. Once download is completed unzip it in C:\selenium
  • Test it.  To test it runs properly follow the following step:
1.   Open command line.
2.   Go to the folder that contains the selenium server. (You can go using DOS cd command to navigate from one folder to another.). Type following commands: java -jar selenium-server-standalone-2.0rc2.jar. If it runs successfully, you will see the following screen:

If it doesn't run check the error message. Usually, problem is with the port. Selenium server’s default port is 4444. If it is taken already, problem occurs. Easy solution is to restart your machine.

 Next step is to run your script from the command line. Before I explain more about it, let me share my file and folder structure with you. Please look at the files/folders inside 'selenium' folder carefully before you try to run script from the command line.
I have stored my Scripts in this fb_1 folder. Second picture is about where I have put my Selenium Server 2.0

 In this folder I have my script file 'login'. I hope you have saved or renamed all your script with .html extension. If not please do that.
I have created one more .html file named 'testsuite'. (Or you have directly save your test script as "save test suite as"). Here I am going to explain about HTML file I have saved as testsuite.
 This .html file is a part of selenium HTML-testrunner framework and should be kept inside same folder. My script is associated with this file. Let me copy and paste what I have inside my testsuite file:

It is a batch file to run test with one click.
It is the result. It should get updated after each test run.


This is simply unzipped selenium server.
Now we are ready to run our test. You can name your folder and file name anything. But make sure your command is pointing to right path.
Running Test:
I am able to run my test successfully with the help of following command:
java -jar selenium-server-standalone-2.0rc2.jar -htmlSuite "*firefox" "" "c:\\selenium\fb_1\testsuite.html" "c:\\selenium\fb_1\result1.html"
This command invokes test runner. This looks like:

To run test in different browser replace *firefox with :-
Once you can run your script successfully, save your command in a notepad with .bat extension. Next time when you want to run your test, just double-click this batch file. You can schedule your batch file to run automatically at a specific time as well. For this use Windows Scheduled Task utility. You can add as many test script as you want in your batch file. Another will run automatically once previous stops running.
Always remember, Selenium is an open source tool, you might get so many errors before a successful test run. Try to make fewer errors from your side.                   

1 comment:

Saran Raj said...

Simple and useful. I tried it with chrome and ie and it worked. I am not able to understand how to schedule auto-run. This article doesn't explain about the process :(