Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: WWW::Mechanize::Chrome Can't Connect without knowing the port?!

by Corion (Patriarch)
on Sep 26, 2020 at 20:40 UTC ( [id://11122249]=note: print w/replies, xml ) Need Help??


in reply to WWW::Mechanize::Chrome Can't Connect without knowing the port?!

Oops! This seems to be a regression that nobody found yet!

As a workaround, you can use

WWW_MECHANIZE_CHROME_CONNECTION_STYLE=pipe perl -Ilib -MWWW::Mechanize +::Chrome -wle 'my $mech = WWW::Mechanize::Chrome::->new()'

... or, for a script

#!perl use strict; use WWW::Mechanize::Chrome; $ENV{WWW_MECHANIZE_CHROME_CONNECTION_STYLE}='pipe'; my $mech = WWW::Mechanize::Chrome::->new(); ...

Replies are listed 'Best First'.
Re^2: WWW::Mechanize::Chrome Can't Connect without knowing the port?!
by dexmar (Initiate) on Sep 26, 2020 at 21:05 UTC

    Thank you for the quick reply!!!

    Does that only work headless? When I insert that code into dump-links.pl I get this:

    2020/09/26 14:01:35 Spawning $VAR1 = [ '/usr/bin/google-chrome', '--remote-debugging-pipe', '--enable-automation', '--no-first-run', '--mute-audio', '--no-zygote', '--no-sandbox', '--safebrowsing-disable-auto-update', '--disable-background-networking', '--disable-breakpad', '--disable-client-side-phishing-detection', '--disable-component-update', '--disable-hang-monitor', '--disable-prompt-on-repost', '--disable-sync', '--disable-translate', '--disable-web-resources', '--disable-default-apps', '--disable-infobars', '--disable-popup-blocking', '--disable-gpu', '--disable-save-password-bubble', 'about:blank' ]; 2020/09/26 14:01:35 Spawned child as 3455 [3455:3455:0926/140135.852054:ERROR:browser_main_loop.cc(1434)] Unable + to open X display. 2020/09/26 14:01:35 Sent message $VAR1 = '{"id":1,"method":"Target.get +Targets","params":{}}'; $VAR1 = [ bless( { 'read_len' => 8192, 'reader' => '_sysread', 'cb_r' => sub { "DUMMY" }, 'want_readready' => 1, 'close_on_read_eof' => 1, 'handle_closing' => undef, 'write_handle' => \*{'WWW::Mechanize::Chrome::$pare +nt{...}'}, 'want_writeready' => 1, 'read_handle' => \*{'WWW::Mechanize::Chrome::$paren +t{...}'}, 'want' => 9, 'on_read' => sub { "DUMMY" }, 'write_eof' => 1, 'writequeue' => [ bless( [ '{"id":1,"method":"Targe +t.getTargets","params":{}}', 8192, undef, undef, undef, 0 ], 'IO::Async::Stream::Wri +ter' ) ], 'write_len' => 8192, 'writeable' => 1, 'readqueue' => [], 'writer' => '_syswrite', 'cb_w' => sub { "DUMMY" }, 'on_write_error' => sub { "DUMMY" }, 'IO_Async_Notifier__loop' => bless( { 'os' => {}, 'deferrals' = +> [], 'sigattaches' + => {}, 'timequeue' = +> undef, 'pollevents' +=> { + '7' => 16, + '6' => 12 + }, 'notifiers' = +> { + '94094341331112' => $VAR1->[0] + }, 'childwatches +' => {}, 'pollmask' => + { + '6' => 4, + '7' => 1 + }, 'childmanager +' => undef, 'threadwatche +s' => {}, 'iowatches' = +> { + '6' => [ + $VAR1->[0]{'write_handle'}, + undef, + $VAR1->[0]{'cb_w'} + ], + '7' => [ + $VAR1->[0]{'read_handle'}, + $VAR1->[0]{'cb_r'} + ] + }, 'poll' => und +ef, 'old_timer' = +> '' }, 'IO::Async:: +Loop::Poll' ), 'readbuff' => '' }, 'IO::Async::Stream' ), 'Broken pipe' ];
      [3455:3455:0926/140135.852054:ERROR:browser_main_loop.cc(1434)] Unable + to open X display.

      So maybe your Chrome process can't connect to your display server. This would explain why it works headless but not when trying with a display. I don't know why Chrome can't connect to a display - are you launching the process as a different user or in a shell without the DISPLAY variable set?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-19 23:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found