Corion / WWW-Mechanize-Chrome

automate the Chrome browser
https://metacpan.org/release/WWW-Mechanize-Chrome
Artistic License 2.0
30 stars 12 forks source link

Can't connect without knowing the port?! 0 at .../Chrome/DevToolsProtocol.pm line 317. #56

Open hakonhagland opened 3 years ago

hakonhagland commented 3 years ago

With a running Chrome browser already open, when I run this program (Ubuntu 20.04, perl version 5.30, Chrome Version 89.0.4389.114 (Official Build) (64-bit)) :

use strict;
use warnings;
use Log::Log4perl qw(:easy);
use WWW::Mechanize::Chrome;
Log::Log4perl->easy_init($ERROR);
my $mech = WWW::Mechanize::Chrome->new(
    autoclose => 0,
    tab       => 'current',
);

the constructor WWW::Mechanize::Chrome->new() aborts with

Can't connect without knowing the port?! 0 at /home/hakon/perlbrew/perls/perl-5.30.0/lib/site_perl/5.30.0/Chrome/DevToolsProtocol.pm line 317.

See also this question on stackoverflow.

hakonhagland commented 3 years ago

Some more information:

So my guess is that there is some sort of chrome server still running in the first case, whereas in the second case the server is also shut down. And this is needed for the script to run properly ?

ZaxonXP commented 3 years ago

I am facing the same issue.