Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^4: How to use synchronize method with WWW::Mechanize::Firefox?

by Corion (Patriarch)
on Mar 27, 2016 at 14:07 UTC ( [id://1158875]=note: print w/replies, xml ) Need Help??


in reply to Re^3: How to use synchronize method with WWW::Mechanize::Firefox?
in thread How to use synchronize method with WWW::Mechanize::Firefox?

Do you really need to use ->synchronize? This method is mostly useful if you want to do things that do not end up loading a new page.

Replies are listed 'Best First'.
Re^5: How to use synchronize method with WWW::Mechanize::Firefox?
by nysus (Parson) on Mar 27, 2016 at 15:52 UTC

    I'm not wedded to synchronize. I just want to find a more reliable way than sleep(2) and a less ridiculous way than sleep(30) to wait around for the page to load after a login attempt.

    Ultimately, I'm trying to figure out if the login was successful. WordPress just offers up a 200 success code whether login is successful or not so I need to look at the contents of the page to determine if the login worked.

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate";
    $nysus = $PM . ' ' . $MCF;
    Click here if you love Perl Monks

      Maybe looking at the actual HTTP traffic shows you whether the thing detemining the login happens later, maybe through Javascript.

      I did not find a convenient way to list all events as they happen during page load. Maybe you're looking at the wrong Javascript event. In my experiments, I found DOMContentLoaded to be quite reliable, but maybe in your case load is more reliable.

        Yeah, I tried load already. Didn't make a difference.

        $PM = "Perl Monk's";
        $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate";
        $nysus = $PM . ' ' . $MCF;
        Click here if you love Perl Monks

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1158875]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-03-30 08:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found