D. Woodill wrote:
--- Robin Becker <[EMAIL PROTECTED]> wrote:
It is alo fairly easy to patch the eventloop to cause
waits to timeout.
Even if that happens there's no mechanism for waits to
'fail' (a bigger patch is required).
--
Robin Becker
How about a loop with an escape button that would
allow Selenium users to get on with it when they
run out of patience, like the panic button on
midi software that you hit when all the notes stick
on and the ugly chord makes your head want to
explode.
....
certainly the patch that does the timeout can be triggered by any suitable
event. For an automatic test the button pusher isn't available. The problem of
causing the wait to 'fail' is still there anyhow.
I added this to TestLoop
this.setPollTimeout =function(t){
if(t){
this.pollTimeout = window.setTimeout("testLoop.checkPollTimeout()",
t);
}
}
this.checkPollTimeout=function(){
if(this.waitForCondition){
this.waitForCondition = function(){return true;}
}
}
and then changed pollUntilConditionIsTrue to look like
/**
* Busy wait for waitForCondition() to become true, and then continue
command execution.
*/
this.pollUntilConditionIsTrue = function () {
if (this.waitForCondition()) {
if(this.pollTimeout){
window.clearTimeout(this.pollTimeout);
this.pollTimeout = null;
}
this.waitForCondition = null;
this.continueCommandExecutionWithDelay();
} else {
window.setTimeout("testLoop.pollUntilConditionIsTrue()", 10);
}
};
so the timing out is fairly easy with an explicit setTimeOut call on the
testloop. It's fairly easy to generalize things to allow for a default timeout
value for all waits. Also it seems harder to get the fact that the timeout
occurred into pollUntilConditionIsTrue; I suppose we could set a value onto the
testloop inside checkPollTimeout and return it if available in
pollUntilConditionIsTrue. Assuming that we can get that information into the
return value of pollUntilConditionIsTrue what should be done with it to indicate
the wait failed?
--
Robin Becker
_______________________________________________
Selenium-users mailing list
Selenium-users@lists.public.thoughtworks.org
http://lists.public.thoughtworks.org/mailman/listinfo/selenium-users