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

botmation

v3.0.0

Published

A simple TypeScript framework for building composable web bots declaratively with Puppeteer

Downloads

13

Readme

npm Build Status Known Vulnerabilities codecov Quality Gate Status dependencies Status GitHub

Botmation is a simple TypeScript framework to build web bots with Puppeteer in a declarative, functional and composable way.

“Everything should be made as simple as possible, but no simpler.” - Albert Einstein

Why choose Botmation?

It empowers Puppeteer code with a simple pattern to maximize code readability, reusability and testability.

Its compositional design comes pre-built with safe defaults for building bots with less code.

It encourages a learn at your own pace approach to exploring the possibilities of Functional programming.

It has 100% source code test coverage.

Introduction

Botmation is simple declarative framework for Puppeteer, to build web bots in a composable way. It provides a simple pattern focused on a single type of function called BotAction.

BotAction's handle everything from simple tasks in crawling and scraping the web to logging in & automating your social media. They are composable. They make assembling Bots easy, declarative, and simple.

The possibilities are endless!

Getting Started

Botmation is a NodeJS library written in TypeScript. You'll need node.js LTS installed and the TypeScript compiler (tsc) installed globally (or have a transpiling code step).

Install

Install Botmation with npm and save it as a dependency:

npm install --save botmation

If you're just getting started, install puppeteer & @types/puppeteer:

npm install --save puppeteer 
npm install --save-dev @types/puppeteer

Documentation

To get started with Botmation, learn about its design and pattern, view API Doc's, see examples, advanced techniques, and a tutorial on approaching these Bot problems, visit the official Botmation Documentation site.

Library Reference

After intalling through npm, import any BotAction from the main module:

import { chain, goTo, screenshot } from 'botmation'

As of v3.x, there are 14 groups of BotAction to compose from:

  • abort
    • abort an assembly of BotAction's
  • assembly-line
    • compose and run BotAction's in lines
  • console
    • log messages to the nodeJS console
  • cookies
    • read/write page cookies
  • errors
    • try/catch errors in assembly-lines
  • files
    • write files to local disk ie screenshots, pdf's
  • indexed-db
    • read/write to page's IndexedDB
  • inject
    • insert new injects into a line of BotAction's
  • input
    • simulate User input ie typing and clicking with a mouse
  • local-storage
    • read/write/delete from a page's Local Storage
  • navigation
    • change the page's URL, wait for form submissions to change page URL, back, forward, refresh
  • pipe
    • functions specific to Piping
  • scrapers
    • scrape HTML documents with an HTML parser and evaluate JavaScript inside a Page
  • utilities
    • handle more complex logic patterns ie if statements and for loops

Examples

In the ./src/examples directory of this repo (excluded from the npm module), exists a small collection of simple bots, to help you get going:

Dev Notes

Library Development

First, clone the repo locally, then install the npm dependencies. You can build the library locally with this command:

npm run build

The playground_bot is a dedicated spot for trying out new Bot Actions, etc. You can run it's code, after running the build command, with:

npm run playground

Library Testing

All our testing (e2e, unit, and integration) is done with Jest.

Learn more about the library's testing strategy and coverage with the Botmation: Tests documentation.

Issues & Feature Requests

Open Issues on Github. Please specify if it's a feature request or a bug.

When reporting bugs, please provide sample code to recreate the bug, relevant error messages/logs, and any other information that may help.

Contributors

Code

Michael Lage - Blog

Art

Patrick Capeto - Email