sub WaitforDone{
my $self = shift;
my $agent = $self->{agent};
while ($agent->Busy || $agent->document->readystate ne "complete"){
sleep 1;
}
}
####
sub Win32::IEAutomation::WaitforDoneTimeout {
my( $self, $timeout ) = @_;
$timeout ||= 0;
my $starttime = time;
my $agent = $self->{agent};
while( 1 ){
my $loaded = !!( $agent->Busy || $agent->document->readystate ne "complete" );
return "loaded" if $loaded;
sleep 1;
if( (time - $starttime) > $timeout ){
return "timedout";
}
}
return "nuclear explosion";
}
####
sub Click{
my ($self, $nowait) = @_;
$self->{element}->click;
$self->{parent}->WaitforDone unless $nowait;
}