Running Selenium TestRunner slowly

By default Selenium TestRunner executes the test blindingly fast. You can however slow down the execution by using the speed controller slider in the right pane, which adds a maximum delay of 1 second after every command execution. But you have to do that manually for every test, and the maximum delay you get is 1 second. You can however increase the delay and also set the default delay rate by editing the selenium-testrunner.js file.

Editing the selenium-testrunner.js file

First you have to find the ‘selenium-testrunner.js’ file. It is located in your ‘Windows\Application Data’ directory. The rough path is given below:

Documents and Settings\Application Data\Mozilla\Firefox\
Profiles\extensions\{a6fd85ed-t567-s34f-a5af-ddf48bda539f}\content-files

Your exact directory path will be different. It is best do do a search for the file in your ‘Mozilla’ directory. Once you have found it, you can look for the following lines of code:

reset: function() {
        this.runInterval = this.speedController.value;
        this._switchContinueButtonToPause();
    },

and replace it with:

reset: function() {
        this.runInterval = 2000;
        this._switchContinueButtonToPause();
    },

This will by default add a 2 second delay after every command execution. Note that as we have made hardcoded changes to the speed variables, the speed slider in the TestRunner window will no longer have any effect on the execution.

Setting the default speed controller delay to a high value

In view of a recent comment, you can also set the default high delay for your slider by replacing the following lines in ‘selenium-testrunner.js’.

this.speedController = new Control.Slider('speedHandle', 'speedTrack', {
            range: $R(0, 1000),
            onSlide: fnBindAsEventListener(this.setRunInterval, this),
            onChange: fnBindAsEventListener(this.setRunInterval, this)
        });

with

this.speedController = new Control.Slider('speedHandle', 'speedTrack', {
            range: $R(100, 5000),
            onSlide: fnBindAsEventListener(this.setRunInterval, this),
            onChange: fnBindAsEventListener(this.setRunInterval, this)
        });

Which will set the default delay to 100 milliseconds and the maximum to 5 seconds. Now you can also use the speed slider.

4 thoughts on “Running Selenium TestRunner slowly

  1. why not use


    reset: function() {
    this.runInterval = (this.speedController.value * 2);
    this._switchContinueButtonToPause();
    },

    That way you can still use the slider, but have your maximum 2 seconds 🙂

  2. The point was to set the default value to something high without manual intervention. As the default ‘speedController’ value is ‘0’, the above code will set the default to ‘0’. To increase the default value and also use the slider, we can edit the following lines:


    this.speedController = new Control.Slider('speedHandle', 'speedTrack', {
    range: $R(0, 1000),
    onSlide: fnBindAsEventListener(this.setRunInterval, this),
    onChange: fnBindAsEventListener(this.setRunInterval, this)
    });

    to


    this.speedController = new Control.Slider('speedHandle', 'speedTrack', {
    range: $R(100, 5000),
    onSlide: fnBindAsEventListener(this.setRunInterval, this),
    onChange: fnBindAsEventListener(this.setRunInterval, this)
    });

  3. I learned a lot at thedevmasters.com. It is an amazing service special there mentoring program gave me real hand on experience in troubleshooting. I was able to create a full selenium testing Project in less than 4 hour time all by myself. Amazing professional team of mentors and software educators.
    DevMaster also got me selenium testing . They gave very good exam preparation material
    Visit http://www.thedevmasters.com and robin@thedevmasters.com, 1(866)340-1375

Comments are closed.