What Is Puppeteer?

Puppeteer was originally created by the Chrome/Google development team, Puppeteer automates Chromium based browser (Chrome, Edge, Brave and even Firefox). It runs in both headless and interactive mode. Headless being the default, it runs the browser emulation without needing to render it to screen.

With a massive 79.8k stars at the time of writing, this is one of the most popular libraries on Github, and is used by many organisations for many purposes ranging from test, to gathering information for several purposes. Adappt used this in 2020 to gather Covid stats from each govt for the World Health Organization.

The real power of Puppeteer is that it will faithfully render pages in the same way as Chrome / Edge, using the very latest release of the Chromium engine and all whilst running in headless mode. This makes it perfect for integration into CI/CD pipelines running on servers without GPUs

Puppeteer can be used for automated browser testing. It is fast and robust and has a ‘clean syntax’ that allows the user to write readable tests.

Tech Language

It runs under a NodeJS framework with an easy to use Application Programming Interface (API) that allows testing of code written for Chrome or Chromium browsers. By default, it is configured to run ‘headless’, which means no visible UI (User Interface); it is able to render and understand the HTML the same way a browser would.

Features

  • It can automate any action in a browser and can test various versions of each browser.
  • It can test Single Page Automation (SPA)
  • It’s very quick and with Chrome and much faster than Selenium.
  • It can capture a timeline trace of the website, helping to diagnose performance issues. As Puppeteer communicates only through the DevTools protocol, it only supports browsers which implement this protocol.

A Built-in Feature for browsers

Puppeteer contains a ‘Recorder’; a built-in feature of chrome, allowing developers to and record actions as a Puppeteer script. This tool has an effective way to generate Puppeteer scripts giving efficient results, these are then configured to run automatically on the browser. As with all the other testing methods, when there have been different sets of codes, then the automatic script run through to identify the ‘bug’ that has been introduced.

Puppeteer With Jest and Other Extra Plugins

Jest is a Javascript Testing Framework created by Facebook. It’s fast and easy to install. The project Jest Puppeteer allows developers to run tests they made for Jest on Puppeteer.

There is also a “Puppeteer Extra” project with useful plugins such as ad-blockers, re-captcha handling and others useful extras.

Safeguard Your Brand With Outsourced Software Testing Services
An unhandled exception has occurred. See browser dev tools for details. Reload 🗙