Ok the title is a bit long but why google create such a nice debug interface and make it so difficult to access it.
1. open chrome with remote debug enabled
chromium --remote-debugging-port=9222 https://github.com/
2. Install websocat to create websocket to chrome
sudo pacman -S websocat
3. Find magic chrome ws url. To do that visit following url
http://127.0.0.1:9222/json/list
4. Connect to the websocket
websocat ws://127.0.0.1:9222/devtools/browser/<GUID>
5. Execute magic command. Here just scrolling the page
{"id": 1, "method": "Runtime.evaluate", "params": {"expression": "document.documentElement.scrollTop = 600"}}
http://127.0.0.1:9222/json/list
or see cdp tutorial for further information.chrome_loop.sh
inotifywait -q -m -e close_write cmd | while read -r filename event; do cat cmd | websocat -n1 ws://127.0.0.1:9222/devtools/page/<GUID> done
cmd
{"id": 1, "method": "Runtime.evaluate" , "params": {"expression": "alert('hi')"}}