Google's Puppeteer Tutorial

Puppeteer is not a automation tool, it is the browser with Nodejs module and the browser is chromium

Puppeteer is not a browser automation tool like selenium, protractor, webdriverIO. Puppeteer is a node module created to control the internals of the chromium browser. Or people sometimes say Chromium is like the dev tool present in the chrome, so the user can do all the things with puppeteer that are able to do using the dev tool.


dev-tools-puppeteer

Puppeteer help users to automate the chrome and edge browsers (internally chromium).

In reality, puppeteer automates the engine called chromium also there is a browser on the chromium engine called chromium, I hope you guys know that Google Chrome is freeware but not open source, but Chromium is opensource.

Puppeteer is not a testing tool but a development tool, as we can perform all the tasks that a developer can perform.

If you have visited the dev tools of the chrome, you might have seen multiple functionalities. We can perform operations using those functionalities like checking page speed, handle ing request and response and finding elements, etc.

Puppeteer works without the chrome browser(no need of installing chrome), As the puppeteer downloads the chromium. In other terms, we can say puppeteer is nothing but chromium.

The Puppeteer module can test the chromium/chrome/edge with and without the UI.

Puppeteer is faster than all the browser-based automation tools in the market

With puppeteer we can actually perform all the tasks just like chrome, which includes audits, lighthouse, emulating devices.

Puppeteer Architecture Pyramid

puppeteer-pyramid-architecture-nodejs-chrome-edge

Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the DevTools Protocol.

There are four levels in the Pyramid:

  • Headless/UI browser : It is the browser level where browser reacts the actions performed in the browser engine.
  • CDP ( Chromium Development project) : Chromium is the actual place where all the operations are performed, as of today (20th April 2019), Google Chrome and Microsoft Edge use the Chromium as the engine.
  • Puppeteer : Puppeteer is the node module package, which is nothing but chromium.
  • Test Script : Test script level also known as NodeJS level where we write our test cases using javascript technologies.

Google Puppeteer Usages

  • Scraping content from websites and web applications;
  • Web and UI testing: automated tests, browser features tests, compatibility with Chrome versions;
  • Working with no CSS/js and no images
  • we can find How much CSS and JS are used by a page using coverage
  • Taking screenshots and exporting web pages as PDF;
  • Rendering website with a look-like Googlebot WRS for SEO;
  • Auditing web performance stuff with Headless Chrome and using lighthouse;
  • Anything Google Chrome can do and your imagination is the limit.
Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions

Protractor Training