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 read websocket endpoint from Chrome output because of 10 lines limit in sub read_devtools_url

Domram opened this issue · comments

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.

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