Puppeteer Examples
Puppeteer example scripts for running Headless Chrome from Node.
Install / Use
npx skills add checkly/puppeteer-examplesInstalls into whichever agent you are using.
README
Puppeteer examples
Deprecation notice: We are moving our efforts to theheadless.dev, a new free & open source knowledge base for Puppeteer AND Playwright. Idea is the same: practical examples and guides, by the community. We — the team at Checkly — are going to pour a lot of love & care into this new project. Feel free to contribute!
Puppeteer Headless Chrome examples for real life use cases. Clone this repo and run them directy with a simple node command.
git clone https://github.com/checkly/puppeteer-examples
cd puppeteer-examples
npm i
node 2.\ search/amazon.js
You can run these scripts in the puppeteer sandbox.
1. basics
The very basic on getting useful info from web page. Highlights the basic Puppeteer functions.
alerts
Create an alert dialog and close it again.
Download file / upload file
Find an image by class selector, downloads the image, saves it to disk and read it again. Use this together with a .fileUpload() method.
emulate devices
Use the built in devices descriptors to emulate an Iphone 6. These are actually shortcuts for calling page.setUserAgent() and page.setViewPort().
get the value of common form elements
Gets the value of commonly used HTML form elements using page.$eval()
get list of links
Scrapes Hacker News for links on the home page and returns the top 10
1. basics/get_list_of_links.js
get text value of an element
Gets the text value of an element by using the page.$eval method
get title
Get the title of a page and print it to the console.
hover
The hover function is a combination of scrolling and putting the mouse into a hover state over the requested element. This example hovers the first track we find on the soundcloud.com homepage, which should trigger the play and like buttons to be visible
keyboard
types into a text editor
location_faker
Fake the location for the geolocation API used by the browsers
mouse
Most of the things you can click using straight .click() handlers, but for some situation directly instructing the mouse might be convenient. This example load a page that plays back what mouse actions are used on the page.
Renders a PDF of the Puppeteer API spec. This is a pretty long page and will generate a nice, A4 size multi-page PDF.
request interception
Uses Puppeteer request interception, blocks images from loading, then snaps a basic screenshot of the full New York Time homepage and saves it a .png file.
1. basics/request_interception.js
screenshots
Snaps a basic screenshot of the full New York Time homepage and saves it a .png file.
screenshots clipped
Grabs and clips out just the stock tickers on the Yahoo finance page
1. basics/screenshots_clipped.js
set cookie
Sets the "login_email" property in a Paypal cookie so the login screen is pre-filled with an email address.
2. search
Common search input and select methods on search results.
Amazon search
Looks for a "nyan cat pullover" on amazon.com, goes two page two clicks the third one.
Booking.com search
Finds accommodations in Berlin on Booking.com, takes a screenshot and logs the top 10.
Duck Duck Go search
undefined
Youtube search
Looks for Fleetwood Mac's "Dreams" video on youtube.com and clicks on the third video. Waits for 5 seconds for the video to load.
3. login
Common login scenarios on popular website. Credentials mostly supplied with setting ENV variables.
Github
Logs into Github. Provide your username and password as environment variables when running the script, i.e: GITHUB_USER=myuser GITHUB_PWD=mypassword node github.js
Google Social Login
Logs into Checkly using Google social Login. Provide your username and password as environment variables when running the script, i.e: GOOGLE_USER=myuser GOOGLE_PWD=mypassword node google_social.js
Logs into Instagram with credentials. Provide your username and password as environment variables when running the script, i.e: INSTAGRAM_USER=myuser INSTAGRAM_PWD=mypassword node instagram.js
Microsoft Live Login
Logs into MS Live. Provide your username and password as environment variables when running the script, i.e: linux: MSLIVE_USER=myuser MSLIVE_PWD=mypassword node mslive.js Windows users: SET MSLIVE_USER=myuser SET MSLIVE_PWD=mypassword node mslive.js for more info see here: https://stackoverflow.com/questions/9249830/how-can-i-set-node-env-production-on-windows
4. shopping-carts
How to handle shopping cart functions like adding and removing items.
Staples shopping cart
Goes to the face paint category and adds to the shopping cart.
Walmart shopping cart
Looks for a Nintendo's Mario Odyssey and adds it to the shopping cart.
5. parallel-pages
How to handle Allow parallel processing pages.
Screenshots parallel pages
Allow parallel processing screenshot
[5. parallel-pages/screen
Related Skills
node-connect
385.5kDiagnose OpenClaw Android, iOS, or macOS node pairing, QR/setup code, route, auth, and connection failures.
Writing Hookify Rules
140.7kThis skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.
Agent Development
140.7kThis skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or…
Command Development
140.7kThis skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs gu…
