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

Could not read websocket endpoint from Chrome output because of 10 lines limit in sub read_devtools_url #74

Closed Domram closed 8 months ago

Domram commented 1 year ago

I was getting error Could not read websocket endpoint from Chrome output. Do you maybe have a non-debug instance of Chrome already running? at line 1052 of Chrome.pm

I noticed that there a 10 lines read attempts at sub read_devtools_url and I found that I was getting exactly 10 lines of "irrelevant" warnings from Chromium related to GTK and one related with Chrome's Cloud management controller regardless of whether I was running Chromium from the module or directly. Therefore the module stopped looking for the websocket endpoint from Chromium output after reading not enough lines to actually find it.

I solved it by increasing lines read attempts from 10 to 20 modifying: sub read_devtools_url( $self, $fh, $lines = 10 ) { to sub read_devtools_url( $self, $fh, $lines = 20 ) { but I guess that a much higher number or another approach would be probably better.

Corion commented 8 months ago

The number of lines checked is now 50, so this should not be an immediate problem anymore :D