Headless Chrome REPL not working

3.8k views Asked by At

When I try to run:

google-chrome --headless --disable-gpu --repl http://google.com

getting infinite:

[0829/155519.758686:INFO:headless_shell.cc(303)] Type a Javascript expression to evaluate or "quit" to exit.
>>> {"result":{"type":"undefined"}}
>>> {"result":{"type":"undefined"}}
>>> {"result":{"type":"undefined"}}
>>> {"result":{"type":"undefined"}}
...

Google Chrome 60.0.3112.113 on Ubuntu 16.04

Is it a bug in Chrome?

2

There are 2 answers

1
Gareth Rylance On BEST ANSWER

Use the binary /opt/google/chrome/chrome directly not google-chrome which points to bash script /usr/bin/google-chrome.

Taken from comments in

https://developers.google.com/web/updates/2017/04/headless-chrome#screenshots

0
傅继晗 On

type this

 alias chrome=/opt/google/chrome/chrome

then use chrome

 chrome --headless --disable-gpu --repl http://google.com