/* PHP & MySQL Journal */
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.
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.
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.
|
|
This site is a digital habitat of Sameer, a freelance web developer working from Pune.More
3 Responses
1
Rule
November 25th, 2009 at 2:05 am
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
sameer
November 25th, 2009 at 3:21 am
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
harendra
February 6th, 2010 at 6:04 am
Please let me know if I can set the “Highlight Elements” option checked by default.
Thanks,