npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

puppet

v1.5.0

Published

Natural-language web automation using Puppeteer

Downloads

318

Readme

🎭 Puppet

Natural-language web automation using Puppeteer.

Node CI Travis CI Coverage Dependencies License Vulnerabilities Based on Node.ts npm type definitions npm package npm downloads Contributors semantic-release

npm

⭐️ How it works

Write in natural language (following the Commands section). For example, you can create a file with the following set of commands:

path/to/download.puppet:

Go to typeform.com
Click on the login link
Type username [email protected]
Type password 3rjiw9qie2308
Click on login button
Take a screenshot
Download https://admin.typeform.com/export
Save to to report.csv

Then, run the command:

puppet "path/to/download.puppet"

💡 Usage

CLI

Install the package globally from npm:

npm install --global puppet
# Local Puppet file
puppet "path/to/commands.puppet"

# Remote Puppet file
puppet https://pastebin.com/raw/AeY1MAwF

# Commands directly in CLI
puppet "open example.com" "get page HTML" "save as page.html"

API

Import and use the API:

const { puppet } = require("puppet"); // Node.js
import { puppet } from "puppet"; // TypeScript/ES6

// Local Puppet file
await puppet("path/to/commands.puppet");

// Remote Puppet file
await puppet("https://pastebin.com/raw/AeY1MAwF");

// Commands directly as an array of strings
await puppet(["open example.com", "get page HTML", "save as page.html"]);

🔫 Commands

Navigation

  • Go to example.com
  • Navigate to URL https://example.com
  • Go to the page on example.com
  • Open www.example.com

Timers

  • Wait for 10 seconds
  • Wait for 2 minutes
  • Wait for 100ms
  • Wait for navigation

Screenshot

  • Take a screenshot of this page
  • Take a JPEG screenshot
  • Full screenshot this page
  • Make a transparent screenshot
  • Screenshot and omit the background

Export page to PDF/HTML

  • Save this page as PDF
  • Save page HTML
  • Get the HTML
  • Save the whole page as PDF

Save to file

  • Save result to path/to/file
  • Save this screenshot to path/to/file
  • Save this to the file path/to/file

Mouse events

  • Click on point [123, 456]
  • Right click on coordinates 123, 456
  • Move mouse cursor to points 123, 456
  • Click on 123, 456 using middle mouse button

👩‍💻 Development

Build TypeScript:

npm run build

Run unit tests and view coverage:

npm run test-without-reporting

Related work

  • Puppeteer is the headless Chrome API for Node.js
  • Archiver is the Internet Archive saver I made using Puppeteer
  • TagUI is a CLI for digital process automation (RPA)

✨ Contributors

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

📄 License