How to Use Headless Chrome on Apple OSX

StepByStep how to get headless Chrome up and running on OSX

👍 Headless Chrome has been released in Chrome 59…

  1. Juste download install the last Chrome if is not !
DO NOT install brew google-chrome-canary anymore ! 😀

👻 I am still working with PhantomJS and Nightmare.

2. In your project add chrome alias.

alias chrome="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
Enter it in terminal window. (Once by sessions)

For Chrome Canary

alias canary="/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary"

Or use the absolute path "/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"

3. Try your Headless Chrome

chrome --headless --disable-gpu --dump-dom https://google.com/
or print-to-pdf !
chrome --headless --disable-gpu --print-to-pdf http://www.autreplanete.com/ 
Or to remote control your chrome headless.
chrome --headless --disable-gpu --remote-debugging-port=9222

For Chrome Canary

canary --headless --disable-gpu --dump-dom https://google.com/
or print-to-pdf !
canary --headless --disable-gpu --print-to-pdf http://www.autreplanete.com/
Or to remote control your chrome headless.
canary --headless --disable-gpu --remote-debugging-port=9222

Exemple :

Read: Getting Started with Headless Chrome By Eric Bidelman

Happy Headless Browsing (scraping 😱!).

Node modules :

chromeless

Chrome automation made simple. Runs locally or headless on AWS Lambda.

Chrome Launcher

Launch Google Chrome with ease from node.

  • Disables many Chrome services that add noise to automated scenarios
  • Opens up the browser’s remote-debugging-port on an available port
  • Automagically locates a Chrome binary to launch
  • Uses a fresh Chrome profile for each launch, and cleans itself up on kill()
  • Binds Ctrl-C (by default) to terminate the Chrome process
  • Exposes a small set of options for configurability over these details

https://github.com/GoogleChrome/lighthouse/

List of Chrome Headless Lib.

chrome-remote-interface

Chrome Debugging Protocol interface that helps to instrument Chrome (or any other suitable implementation) by providing a simple abstraction of commands and notifications using a straightforward JavaScript API.

Wiki : https://github.com/cyrus-and/chrome-remote-interface/wiki

DevTools Protocol API docs

Puppeteer (new)

Puppeteer is a Node library which provides a high-level API to control headless Chrome over the DevTools Protocol. It can also be configured to use full (non-headless) Chrome.

More about

Read: Chromeless, Chrominator, Chromy, Navalia, Lambdium, GhostJS, AutoGCD

https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907

Read : https://medium.com/@dschnr/using-headless-chrome-as-an-automated-screenshot-tool-4b07dffba79a

⚠️ Caution: Headless mode is available on Mac and Linux in Chrome 59. Windows support is coming in Chrome 60. To check what version of Chrome you have, open chrome://version.