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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dyyz1993/xpage

v1.0.3

Published

Browser automation engine library based on Playwright

Readme

@dyyz1993/xpage

Browser automation engine library based on Playwright — recording, playback, page structure extraction, and command execution.

CI Status codecov npm version License: MIT

Overview

@dyyz1993/xpage is a powerful browser automation engine built on top of Playwright. It provides:

  • Unified Command Interface — All operations through (page, args) => Promise<result>
  • Recording & Playback — Record user interactions and replay them
  • Page Structure Extraction — Get semantic layout trees
  • Accessibility Tree — Extract ARIA accessibility information
  • Command Chaining — Execute multiple commands in sequence

Install

npm install @dyyz1993/xpage

Requires Node.js >= 18.0.0.

Quick Start

Get started in minutes:

import { executePageCommand } from '@dyyz1993/xpage';
import { chromium } from 'playwright-core';

async function run() {
  const browser = await chromium.launch();
  const page = await browser.newPage();

  // Navigate
  await executePageCommand(page, 'goto', { url: 'https://example.com' });

  // Get title
  const { title } = await executePageCommand(page, 'title', {});
  console.log(title);

  // Take screenshot
  await executePageCommand(page, 'screenshot', { path: 'example.png' });

  await browser.close();
}

run();

See the Quick Start Guide for more examples.

Documentation

Core Capabilities

1. Page Commands

Unified command interface, all operations via (page, args) => Promise<result>:

| Command | Description | Parameters | |---------|-------------|------------| | goto | Navigate to URL | url, waitUntil?, timeout? | | goBack | Go back | — | | goForward | Go forward | — | | reload | Reload page | — | | title | Get page title | — | | url | Get current URL | — | | click | Click element | selector, timeout?, force? | | fill | Fill input | selector, value, timeout? | | type | Type text | selector, text, delay? | | press | Press key | selector, key | | hover | Hover element | selector, timeout? | | scroll | Scroll page | selector?, x?, y? | | select | Select option | selector, value | | check | Check checkbox | selector | | waitForSelector | Wait for element | selector, timeout? | | query | CSS selector query | selector | | find | Find by text | text, tag?, exact? | | html | Get HTML | selector?, clean? | | text | Get text content | selector? | | textContent | Get element text | selector | | inputValue | Get input value | selector | | getAttribute | Get attribute | selector, name | | structure | Page structure extraction | selector?, maxDepth? | | screenshot | Screenshot to file | path?, fullPage? | | screenshotBase64 | Screenshot as Base64 | fullPage?, type? | | a11y | Accessibility tree | selector?, format? | | snapshot | ARIA snapshot | selector? | | evaluate | Execute JS expression | expression | | evaluateRaw | Execute async JS | script | | wait | Wait milliseconds | timeout |

import { executePageCommand } from '@dyyz1993/xpage';
import { chromium } from 'playwright-core';

const browser = await chromium.launch();
const page = await browser.newPage();

await executePageCommand(page, 'goto', { url: 'https://example.com' });
const { title } = await executePageCommand(page, 'title', {});
const { snapshot } = await executePageCommand(page, 'snapshot', { selector: 'body' });

await browser.close();

2. Recorder (RecorderController)

Record user actions in a real browser, producing structured YAML.

import { RecorderController } from '@dyyz1993/xpage';

const recorder = new RecorderController(page);
await recorder.start({ url: 'https://example.com', name: 'my-recording' });
// ... user interacts with browser ...
const { path, session } = await recorder.stop('./recordings/my-recording.yaml');

3. Player (PlaybackEngine)

Load recordings and replay them automatically.

import { PlaybackEngine } from '@dyyz1993/xpage';

const player = await PlaybackEngine.fromFile(page, './recordings/my-recording.yaml');
const result = await player.play({ slowMo: 1, stopOnError: true });

4. Structure Extraction

Extract semantic layout tree from pages.

const { structure, yaml } = await executePageCommand(page, 'structure', { selector: 'body' });

5. Accessibility Tree

const { snapshot } = await executePageCommand(page, 'a11y', { selector: 'main', format: 'yaml' });
const { snapshot } = await executePageCommand(page, 'snapshot', { selector: 'body' });

API Reference

Command Execution

import { executePageCommand, getCommandHandler, hasCommand } from '@dyyz1993/xpage';

const handler = getCommandHandler('click');
const exists = hasCommand('goto');
const result = await executePageCommand(page, 'click', { selector: '#btn' });

Command Definitions & Parsing

import { commands, getCommandNames, parseArgsToRecord, parseCommandChain } from '@dyyz1993/xpage';

commands['goto'].schema;
getCommandNames();
const parsed = parseCommandChain('goto url=https://example.com && click selector=#btn');

Client IPC

import { executeCommand, executePipeline, executeCommandChain, sendRequest } from '@dyyz1993/xpage';

Session Management

import {
  ensureStorage, getSessionPath, loadSessionInfo,
  saveSessionInfo, deleteSessionInfo, listSessions,
} from '@dyyz1993/xpage';

Related Projects

  • @dyyz1993/xcli-core — Plugin-based CLI framework built on this engine
  • create-xcli — Project scaffolding tool
  • @dyyz1993/xcli-browser — Browser domain reference implementation

Development

npm run typecheck   # Type check
npm run lint        # ESLint
npm run build       # Build (tsup)
npm test            # Run tests
npm run validate    # typecheck + lint + build + test

License

MIT