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

browsecraft-bidi

v0.6.3

Published

WebDriver BiDi protocol client for Browsecraft

Readme

browsecraft-bidi

WebDriver BiDi protocol client for Browsecraft.

This package provides low-level browser control using the W3C WebDriver BiDi protocol. It launches and communicates with real, unpatched browser binaries — no special builds or extensions required.

Most users should install browsecraft instead, which provides a higher-level API on top of this package.

Install

npm install browsecraft-bidi

Requires Node.js 20+ and Chrome, Edge, or Firefox installed on your machine.

Usage

import { BiDiSession, launchBrowser } from 'browsecraft-bidi';

// High-level: launch and connect in one step
const session = await BiDiSession.launch({ browser: 'chrome', headless: true });

// Navigate
await session.browsingContext.navigate({
  context: contextId,
  url: 'https://example.com',
  wait: 'complete',
});

// Run JavaScript in the browser
const result = await session.script.evaluate({
  expression: 'document.title',
  target: { context: contextId },
  awaitPromise: true,
});

await session.close();

API

BiDiSession

The main entry point. Provides organized access to BiDi protocol modules:

  • session.browsingContext — create, navigate, close tabs, capture screenshots, locate nodes
  • session.script — evaluate JavaScript, call functions, manage preload scripts
  • session.network — intercept requests, provide responses, manage cookies
  • session.input — perform keyboard, mouse, and touch actions
  • session.storage — get, set, and delete cookies

Factory methods:

| Method | Description | |--------|-------------| | BiDiSession.launch(options?) | Launch a browser and connect via BiDi | | BiDiSession.connect(wsEndpoint) | Connect to an already-running browser |

Instance methods:

| Method | Description | |--------|-------------| | subscribe(events) | Subscribe to BiDi events | | on(event, handler) | Listen for a specific event | | waitForEvent(event, options?) | Wait for an event with optional timeout | | send(method, params) | Send a raw BiDi command | | close() | Close the session and browser |

launchBrowser(options?)

Finds and launches a browser with BiDi support. Auto-detects installed browser paths on Windows, Mac, and Linux.

import { launchBrowser } from 'browsecraft-bidi';

const result = await launchBrowser({
  browser: 'chrome',  // 'chrome' | 'firefox' | 'edge'
  headless: true,
  maximized: false,
});

console.log(result.wsEndpoint); // WebSocket URL for BiDi
await result.close();           // Kill browser and clean up

Transport

Low-level WebSocket transport for BiDi communication. Handles command-response correlation, event dispatch, and timeouts. Used internally by BiDiSession.

Types

Full W3C WebDriver BiDi type definitions are exported, including:

  • BiDiCommand, BiDiEvent, BiDiMessage
  • Browsing context, script, network, input, storage types
  • Locator (CSS, XPath, inner text, accessibility)
  • RemoteValue, NodeRemoteValue, SharedReference
  • BiDiError, BiDiErrorCode

License

MIT