in reply to Unable to automate login to Twitter with WWW::Mechanize::Chrome

I have to apologize - you reported this problem as a bug in WWW::Mechanize::Chrome and I rejected that bug because I could not reproduce it. But it is an actual bug. With your posted code above, I can easily reproduce the issue and the problem is that the code does not cope with a Page.navigatedWithinDocument element at all.

I've added the following code to WWW::Mechanize::Chrome, which should fix that issue, or at least not crash anymore:

} elsif ( my $res = $events{ 'Network.responseReceived' }) { #warn "Network.responseReceived"; $response = $self->httpResponseFromChromeResponse( $res ) +; $response->request( $request ); + } elsif ( my $res = $events{ 'Page.navigatedWithinDocument' }) { + # A fake response, just in case anybody checks + $response = HTTP::Response->new( + 200, # is 0 for files?! + "OK", + HTTP::Headers->new(), + ); + $response->request( $request );

A new version of WWW::Mechanize::Chrome is just testing and then on its way onto CPAN.

Replies are listed 'Best First'.
Re^2: Unable to automate login to Twitter with WWW::Mechanize::Chrome
by nysus (Parson) on Dec 23, 2018 at 15:26 UTC

    Works perfectly now. Thanks so much for the quick fix.

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