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

html to pdf is not working

bsshetty17 opened this issue · comments

chrome version: 118.0.5993.70
When i try to run example test script to convert html to pdf using debug mode, I see that my script hangs trying to make ws connection to browser.
I also observed that after chrome is spawned, i do not see a debug message on "[[DevTools listening on ws://127.0.0.1:41035/devtools/browser/c7f18fa3-ce6d-4b1d-9872-8fc397d52817]]"

and spawn option websocket does not contain following option: '--remote-debugging-address=127.0.0.1',

following is my script:

#!perl -w
use strict;
use Log::Log4perl qw(:easy);
use WWW::Mechanize::Chrome;

my $url = shift @argv
or die "Usage: perl $0 \n";
Log::Log4perl->easy_init($TRACE);
my $mech = WWW::Mechanize::Chrome->new(
headless => 1, # otherwise, PDF printing will not work
);

print "Loading $url";
$mech->get($url);

my $fn= 'screen.pdf';
my $page_pdf = $mech->content_as_pdf(
filename => $fn,
);