Corion / WWW-Mechanize-Chrome

automate the Chrome browser

Home Page:https://metacpan.org/release/WWW-Mechanize-Chrome

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Could not find node with given id

cmadamsgit opened this issue · comments

I am having trouble with some websites, getting this error when getting almost any information:

Could not find node with given id                                               
                                                                                
-32000 at /home/cmadams/perl5/lib/perl5/Chrome/DevToolsProtocol/Target.pm line 5
04

It seems somewhat hit or miss (so maybe some kind of timing issue/race condition?) and varies based on the site. For example, with Amazon, adding a sleep allows $mech->base to work, but still $mech->links fails.

Here's my test code:

#!/usr/bin/perl

use Modern::Perl;
use WWW::Mechanize::Chrome;
use Log::Log4perl qw(:easy);

Log::Log4perl->easy_init ($WARN);
my $mech = WWW::Mechanize::Chrome->new (
    launch_exe => "/usr/bin/chromium-browser",
);

eval {
        $mech->get ("https://amazon.com/");
        $mech->sleep (1);
        print $mech->base, "\n";
        print $_->text . " -> " . $_->url . "\n" for $mech->links;
};
print $@ if ($@);
$mech->target->send_message ("Browser.close")->get;
sleep (1);

And sorry, meant to add: this is on Fedora Linux 37 with perl 5.36.1, WWW::Mechanize::Perl 0.70, and Chromium 114.0.5735.198.