Friday, March 04, 2005

Quick update on Selenium in TestRunner mode

Ian Bicking made a good point today on the selenium-devel mailing list: the introductory Selenium documentation makes things look much more complicated than they really are. And my previous post on Selenium falls in the same trap. It's true that I focused my tutorial on the Twisted server-driven mode of Selenium, but I should have made it clear that it's really easy to get started with Selenium in TestRunner mode if you have a Web application that you need to test.

Basically, all you need to do is to either download Selenium or check it out via svn from svn://, then copy the contents of the javascript directory (all its files and sub-directories) to a directory that can be served via your Web server.

I created a directory called selenium under the DocumentRoot directory of one of my Apache virtual servers, then I pointed my browser to and I was good to go -- that is, I could see all the sample tests and start experiment with them.

Note that in the current version, many of the shipped tests will fail, unless you do the following correction: edit selenium-api.js and delete the assertLocation function, then paste these lines in its place:

* Verify the location of the current page.
Selenium.prototype.assertAbsoluteLocation = function(expectedLocation) {

* Verify the location of the current page ends with the expected location
Selenium.prototype.assertLocation = function(expectedLocation) {
var docLocation =;
assertTrue(docLocation.length == docLocation.indexOf(expectedLocation) + expectedLocation.length);

To add your own tests, start from one of the sample tests, add your HTML test file to the "tests" subdirectory and edit the tests/TestSuite.html file by adding a new row pointing to your test.

Note: in the TestRunner mode of Selenium you will only be able to test the functionality of your own Web site. You will not be able to run tests against third party sites such as Google or Amazon, due to the cross-scripting security limitation of JavaScript.

By the way, Jason Huggins is asking for suggestions for better naming the 2 main Selenium implementation/execution modes. Currently, the nomenclature is:

1) "TestRunner mode", a.k.a "HTML table-style", "FIT style", "browser driven"
2) "Driven mode", a.k.a "source code-style", "server driven"

If you have a better descriptive name for Selenium in these modes, please leave a comment.


Anonymous said...

"Note that in the current version, many of the shipped tests will fail, unless you do the following correction: edit selenium-api.js and delete the assertLocation function, then paste these lines in its place:"

Why isn't this in CVS or in the newest release? I'm lucky I found this otherwise I would have thrown Selenium to the side pretty fast.

Oh, and it still doesn't work :(

Anonymous said...

On the subject of nomenclature, I don't think the problem is as much a matter of naming as it is a matter of packaging. Treating two substantially different ways of working with Selenium as "modes" of operation is the confusing part. My recommendation is to treat FitRunner and Driven as two different products. Offer them as separate downloads. Give them separate sites or sections of the site. Unless you're a Selenium developer, the fact that FitRunner and Driven share common code is pretty irrelevant.

For example, name them "Selenium FitRunner" and "Selenium Driven". Have a section of the site devoted to each, separtely. Separate FAQs or sections within a larger "Selenium" FAQ. Separate documentation. Distribute them as follows: FitRunner only, Driven only, and FitRunner + Driven bundle.

Anonymous said...

Very interesting blog. I'm still readin' it.

BTW, I agree ;)

Anonymous said...


I'm a complete beginner with Selenium.

When you say Download Selenium (the link youve posted is not available at the moment) do you mean Selenium Core or IDE?

Unknown said...

I am a beginner in selenium... are there any introductory slides or whitepapers available..
please mail them across to me.
my email

Arul shaji said...

Great article with good description! thanks a lot for sharing this useful info with us.

Modifying EC2 security groups via AWS Lambda functions

One task that comes up again and again is adding, removing or updating source CIDR blocks in various security groups in an EC2 infrastructur...