/*
* Extend Selenium core with reloadAndWaitFor* asserts (reload as often as necessary for up to 60 seconds)
* Copyright 2007 - local.ch ag
* Version 0.2
* 0.1: Initial release
* 0.2: Remove redundancies
* 0.3: Fix reloading
*/
CommandHandlerFactory.prototype._oldRegisterWaitForCommandsForPredicate = CommandHandlerFactory.prototype._registerWaitForCommandsForPredicate;
CommandHandlerFactory.prototype._registerWaitForCommandsForPredicate = function(commandTarget, baseName, predicateBlock) {
this._oldRegisterWaitForCommandsForPredicate(commandTarget, baseName, predicateBlock);
var cmdBlock = this._reloadAndWaitForActionForPredicate(predicateBlock);
this.registerAction("reloadAndWaitFor" + baseName, cmdBlock, false, true);
var invertedCmdBlock = this._invertPredicate(cmdBlock);
var invertedNotCmdBlock = this._reloadAndWaitForActionForPredicate(invertedCmdBlock);
this.registerAction("reloadAndWaitFor" + this._invertPredicateName(baseName), invertedNotCmdBlock, false, true);
this.registerAction("reloadAndWaitForNot" + baseName, invertedNotCmdBlock, false, true);
}
CommandHandlerFactory.prototype._reloadAndWaitForActionForPredicate = function(predicateBlock) {
return function(target, value) {
var retval = Selenium.decorateFunctionWithTimeout(function() {
var status = false;
if (this.lastReload == undefined)
this.lastReload = new Date().getTime();
try {
status = predicateBlock(target, value).isTrue;
} catch (e) {
}
if (status == false) {
if (new Date().getTime() > this.lastReload+1000) {
selenium.doRefresh();
this.lastReload = new Date().getTime();
}
}
return status;
}, 70000);
return retval;
};
};
I followed the directions and added the program text into the user-extensions.js file and restarted Selenium IDE. I now get the error "Failed to load user-extensions.js!" and "error=ReferenceError: CommandHandlerFactory is not defined"
What is missing? I am new to java script. I can edit as needed.