A simple Node.js script that interacts with an instance of Chrome headless in order to take a screenshot.
To start Chrome headless:
$ chrome --headless --disable-gpu --remote-debugging-port=9222 https://example.com/
To run the script:
$ node index.js
The screenshot will be named screenshot.png
and saved in the current directory.