Chrome Cli



chrome in headless mode can be used as a CLI


Taking screenshot

Size of a standard letterhead 1)

chrome --headless --disable-gpu --screenshot --window-size=1280,1696

Printing the DOM

The –dump-dom flag prints document.body.innerHTML to stdout:

chrome --headless --disable-gpu --dump-dom

Create a PDF

The –print-to-pdf flag creates a PDF of the page:

chrome --headless --disable-gpu --print-to-pdf

REPL mode (read-eval-print loop)

The –repl flag runs Headless in a Javascript engine in REPL mode

chrome --headless --disable-gpu --repl --crash-dumps-dir=./tmp
[0608/] Type a Javascript expression to evaluate or "quit" to exit.
>>> location.href
>>> quit

Recommended Pages
Headless Chrome

is a way to run the Chrome browser in a headless mode (ie without the UI, you don't see the screen, it's a server mode) The Chrome Debugging Protocol is an API that permits to control Chrome (or any...
Javascript - (Interpreter|Engine|Runtime)

Javascript Interpreter (JavaScript_engineJavaScript engine) is a software which interprets and executes JavaScript code. Javascript can run in two different environment: within a browser or without...

Share this page:
Follow us:
Task Runner