Puppeteer: Headless Chrome Node API
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. Puppeteer works only with Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it’s only targeting one browser that enables you to rapidly develop automation scripts. Puppeteer uses the latest versions of Chromium and is licensed under Apache 2.0.
Chrome Headless comes at a right time, especially considering many of the industry standard libraries for automated testing are discontinued by their maintainers. Including PhantomJS, Selenium IDE for Firefox.Chrome Headless seems poised to become the industry leader in Automated Testing of web applications.
Things that can be done with Puppeteer:
- Generate screenshots and PDFs of pages.
- Crawl a SPA and generate pre-rendered content (i.e. “SSR”).
- Scrape content from websites.
- Automate form submission, UI testing, keyboard input, etc.
- Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.
- Capture a timeline trace of your site to help diagnose performance issues.
-Rushi