Actually, Win32::IE::Mechanize does do the polling.

After it calls the click() method on the input object, it calls an internal method called _wait_while_busy, which looks like this:

sub _wait_while_busy { my $self = shift; my $agent = $self->{agent}; # The documentation isn't clear on this. # The DocumentComplete event roughly says: # the event gets fired (for each frame) after ReadyState == 4 # we might need to check if the first one has frames # and do some more checking. my $sleep = 4; # 0.4; # while ( $agent->{Busy} == 1 ) { $sleep and sleep( $sleep ) } # return unless $agent->{ReadyState}; while ( $agent->{ReadyState} <= 2 ) { $sleep and sleep( $sleep ); } $self->{ $_ } = undef for qw( forms cur_form links images ); return $self->success; }

It looks like the author tried polling the Busy property, but that didn't work, and is trying the ReadyState property instead. That seems to work when the preceding call is $agent->navigate() (in Win32::IE::Mechanise::get()), but at least on my system it's breaking when the preceding call is $input->click().

But thanks for the link to the MSDN docs; I'll have a look and see what I can find out.


In reply to Re^2: Getting Win32::IE::Mechanize to wait for responses by mickey
in thread Getting Win32::IE::Mechanize to wait for responses by mickey

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.