Headless browsing

Other topics

Remarks:

Historically, other's have succeeded at using Chrome as a headless browser by running the process in a hidden display.

Invoking Chrome directly is not the only available option for using it as a headless browser. The Embedder API also alows one to use Chrome directly from the application's process.

Taking screenshots

The following will produce a PNG image in the current directory of the loaded page.

chrome --headless --screenshot https://stackoverflow.com

Interacting with documents

Using the --remote-debugging-port to expose a debugger accessible over HTTP is one way appliances can connect and interact with the document using the Chrome Debugging Protocol.

chrome --headless --remote-debugging-port=9222 https://stackoverflow.com

You can then navigate to http://localhost:9222 and use Chrome DevTools interactively.

Syntax:

Contributors

Topic Id: 8619

Example Ids: 26921,26922

This site is not affiliated with any of the contributors.