puppeteer/examples
2024-04-29 08:01:25 +02:00
..
puppeteer-in-browser/out docs: update pdf example 2024-04-29 08:01:25 +02:00
block-images.js chore: use Google's TS style guide's format config (#8542) 2022-06-22 15:25:44 +02:00
cross-browser.js build: fix EsLint rule and add fixer (#11826) 2024-02-05 10:26:37 +01:00
custom-event.js chore: update license headers (#11563) 2024-01-03 10:11:33 +00:00
detect-sniff.js chore: use Google's TS style guide's format config (#8542) 2022-06-22 15:25:44 +02:00
oopif.js chore: update license headers (#11563) 2024-01-03 10:11:33 +00:00
pdf.js docs: update pdf example 2024-04-29 08:01:25 +02:00
proxy.js chore: update license headers (#11563) 2024-01-03 10:11:33 +00:00
README.md docs: add plugin to format package manager scripts (#12254) 2024-04-11 15:47:14 +00:00
screenshot-fullpage.js chore: update license headers (#11563) 2024-01-03 10:11:33 +00:00
screenshot.js chore: update license headers (#11563) 2024-01-03 10:11:33 +00:00
search.js chore: update license headers (#11563) 2024-01-03 10:11:33 +00:00

Running the examples

Assuming you have a checkout of the Puppeteer repo and install the dependencies:

npm install

Build the project:

npm run build

The examples can be run from the root folder like so:

NODE_PATH=../ node examples/search.js

Larger examples

More complex and use case driven examples can be found at github.com/GoogleChromeLabs/puppeteer-examples.

Other resources

Other useful tools, articles, and projects that use Puppeteer.

Rendering and web scraping

  • Puppetron - Demo site that shows how to use Puppeteer and Headless Chrome to render pages. Inspired by GoogleChrome/rendertron.
  • Thal - Getting started with Puppeteer and Chrome Headless for Web Scraping.
  • pupperender - Express middleware that checks the User-Agent header of incoming requests, and if it matches one of a configurable set of bots, render the page using Puppeteer. Useful for PWA rendering.
  • headless-chrome-crawler - Crawler that provides simple APIs to manipulate Headless Chrome and allows you to crawl dynamic websites.
  • puppeteer-examples - Puppeteer Headless Chrome examples for real life use cases such as getting useful info from the web pages or common login scenarios.
  • browserless - Headless Chrome as a service letting you execute Puppeteer scripts remotely. Provides a docker image with configuration for concurrency, launch arguments and more.
  • Puppeteer on AWS Lambda - Running puppeteer on AWS Lambda with Serverless framework
  • Apify SDK - The scalable web crawling and scraping library for JavaScript. Automatically manages a pool of Puppeteer browsers and provides easy error handling, task management, proxy rotation and more.

Testing

  • angular-puppeteer-demo - Demo repository explaining how to use Puppeteer in Karma.
  • mocha-headless-chrome - Tool which runs client-side mocha tests in the command line through headless Chrome.
  • puppeteer-to-istanbul-example - Demo repository demonstrating how to output Puppeteer coverage in Istanbul format.
  • jest-puppeteer - (almost) Zero configuration tool for setting up and running Jest and Puppeteer easily. Also includes an assertion library for Puppeteer.
  • puppeteer-har - Generate HAR file with puppeteer.
  • puppetry - A desktop app to build Puppeteer/Jest driven tests without coding.
  • puppeteer-loadtest - commandline interface for performing load test on puppeteer scripts.
  • cucumber-puppeteer-example - Example repository demonstrating how to use Puppeeteer and Cucumber for integration testing.

Also, see the community list of Puppeteer resources for more examples.