Description
This extension adds command 'sleep' that halts the execution of a test for the specified number of milliseconds.
Code to add to the user-extensions:
user-extensions.js
Selenium.prototype.doSleep = function(locator, paramString) {
var start = new Date().getTime();
while (new Date().getTime() < start + parseInt(locator));
};
Example, halts execution for 10 seconds:
| sleep | 10000 |
Note:
This sleep function is a busy-wait and should probably not be used in most cases. Try to use one of the waitFor commands instead whenever possible.
