I don't see anything in the doc about page state check. What doc?
You are aware that Win32::IEAutomation is only half the docs (more like 5%)?
Win32::IEAutomation uses Win32::OLE to automate InternetExplorer.Application, msdn is where 95% of the docs live, and a whole bunch of that 95% is DOM documentation
Ok, back to checking if page is loaded, we start where we left off with nowait, so if you go to Win32::IEAutomation and Ctrl+Find in page for "wait" you'll find WaitforDone()
If you UTSL and look inside of WaitforDone you will see
sub WaitforDone{
my $self = shift;
my $agent = $self->{agent};
while ($agent->Busy || $agent->document->readystate ne "complete")
+{
sleep 1;
}
}
So you can monkeypatch yourself a $ieauto->WaitforDoneTimeout( 6 );
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";
}
Also if you started from Click by looking inside https://metacpan.org/source/PRASHANT/Win32-IEAutomation-0.5/lib/Win32/IEAutomation/Element.pm#PWin32::IEAutomation::Element sub Click{
my ($self, $nowait) = @_;
$self->{element}->click;
$self->{parent}->WaitforDone unless $nowait;
}
you'd find WaitforDone , so the circle is complete ... that is ieautomation ;)
more generic win32 tips |