paint-brush
Getting your head around chrome headlessby@jungyue
2,357 reads
2,357 reads

Getting your head around chrome headless

by Joseph JungAugust 17th, 2017
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

A slew of automation “stuff” has just arrived due to <a href="https://developers.google.com/web/updates/2017/04/headless-chrome" target="_blank">Chrome’s new headless feature in v59</a>&nbsp;. As creator of <a href="https://www.snaptest.io" target="_blank">snaptest.io</a>, it’s my job to stay up-to-date with them.

Company Mentioned

Mention Thumbnail
featured image - Getting your head around chrome headless
Joseph Jung HackerNoon profile picture

A slew of automation “stuff” has just arrived due to Chrome’s new headless feature in v59 . As creator of snaptest.io, it’s my job to stay up-to-date with them.

So here’s what you need to know:

A headless browser means you don’t see it when you start it, it’s all in memory — and it also implies user actions are automated.

Uses of automation:

  1. QA tests
  2. Scraping
  3. Pre-rendering single-page apps.

Uses of headless:

  1. Less resource intensive.
  2. Great for build-systems running tests before a deploy.
  3. Can run in many more server environments, like Lambda.

Is this the first headless automated browser? No, phantomJS has been the goto browser like this, but the main contributor almost immediately stepped down when he heard about Chrome’s new headless feature . Turns out its hard to maintain an ENTIRE browser.

So what’s actually new in Chrome v59?

  • running the executable like this: `chrome — headless — disable-gpu — remote-debugging-port=9222` which opens it without a visible window.
  • then sending commands to the above port… closest to the metal node library is this one .
  • The above commands give you ability to do almost anything a user would do… so you can scrape data or make tests.

What is the community doing with these new features?

The community has decided that we need a pretty wrapper around this “low level” stuff, and have started making these:

  1. Chromeless (a combination of the words “Chrome” and “Headless” and maybe even “Serverless”).
  2. Puppeteer (Googles very own “lightweight wrapper”)
  3. Simple-headless-chrome (another wrapper)
  4. Ping me if you know of more…

Conclusion:

What’s the state of each of these frameworks? Let’s find out in a couple months once they’ve grown up a bit. Comparing and contrasting right now would be a practice in futility.