DevTools remote debugging at chrome not working normally with headless-chrome

Viewed 1515

I want to debug headless chrome without a browswer UI like this reference

My chrome version is 84.0.4147.105, and chromedriver version is also 84.

When I run headless-chrome, below notice appear at cmd

DevTools listening on ws://127.0.0.1:9224/devtools/browser/~~

And When I enter 127.0.0.1:9224 at chrome, it works normally until yesterday.

But today, when I enter address, below strings shows up.

How can I solve this? No code has been changed before and after.

Error Image

���TQo�0~ϯ���$���li51����manri̜8�������m::��8>�w�ww�%�)��K .�ӏ��5QPJ$�e�Z�j����K�Y���?hI���Ke� ����o-+2!a�DD&���v�)� �5�غ�Qt�yyS��#HH��g���x�t1W>s'��O�B�}�0p�Js��:�; ���%�3!�YO1X�bk�4|�����3��j���n��c'��k�̂���͸'�H�tq��KfKI�z^����|����������v��h4{��wz�\��(n���gu Uv�;g9��Qn��\W^=X�wg�)���de���~��0�L�M ��S����}�5���)r"B�b�Ԃ�ҟs�;�S: ��r� r�r_S�J�{���cLZ�ʒjP-�ʹzu���o��愈���L��л����m�ᖀ��e������aK���ma��v�x��'�-���u�6��<�q��9 �ϵ�������)O?l�Y�D���㽷��w�&N���4�K�>��l�l�K��-�O^�G1��w�jݕ�.��B�N���Qwu���6^��pr��w��,���GG��=2���Lh?��'+;�&�aSdH���=e�}�����5�X=�8;��ꄢ��i��AB-�cu��/:Y

What I want is like below image

enter image description here

2 Answers
  1. Open chrome://inspect in a new tab

2.click on configure button in the Devices section (Refer below image)

click to see image

  1. Add your host address in Target discovery Settings and click done.

  2. Now you may be able to see the remote chrome pages under Remote Target section (Refer below image)

click to see image

Click inspect in it. Now you may able to inspect and debug the headless chrome page

I hit exactly the same wall as you and the same garbled response. I thought it was a bug - even after reboots it didn't come back so i was quietly waiting for a patch.

I just had a more detailed look now and - AT A GUESS - it seems to be related to the open chrome instances.... When i launch the new chrome with the remote debugging tag it attached to an existing chrome not in its own browser.

What i did:

Run these two commands to close all your chrome/chromedriver instances (including this one if you're using chrome - so use something else or copy it to notepad):

taskkill /F /IM chrome.exe
taskkill /F /IM chromedriver.exe

Then run:

chrome --headless --remote-debugging-port=9222 --disable-gpu https://www.google.com

then- Open a new window and, for me, i was able to connect again. Connect here: http://127.0.0.1:9222/

And get this... This is different to what i used to see. Even though i ran headless, i still have my other windows (inc this message!) and my extensions.

enter image description here

Selecting the stack overflow window just for fun just about make out me typing this reply in the body of the remote window:

stack in remote debug

As i type this now, my mouse has become locked as the remote cursor "blob" - so there is still some buggyness to it. However this worked for me to get this gets it back online.

Chrome version: Version 84.0.4147.105 (Official Build) (64-bit)

Related