BoxLang Playwright
Star
BoxLang module · powered by Microsoft Playwright

Real browsers.
Fluent BoxLang.

bx-playwright drives Chromium, Firefox and WebKit from BoxLang. Test your apps end to end, mock the network, test APIs, render HTML to PDFs and images, and give AI agents a browser. One fluent API, no Node.js project to maintain.

$install-bx-module bx-playwright|bxPlaywright install
login flow passed · 1.2s
login.bxs
playwright().browse( ( page ) => {
    page.visit( "/login" )
        .fill( "Email", "luis@ortus.com" )
        .fill( "Password", "secret" )
        .click( "Sign in" )
        .assertPathIs( "/dashboard" )
        .assertSee( "Welcome back" )
        .screenshot( "dashboard.png" )
} )
Chromium · Firefox · WebKit
How it works

Write it like a user. Run it like a browser.

Install
Browse
Assert
Ship

Selectors read like the page: fill( "Email" ), click( "Sign in" ). Assertions wait for the page, so tests do not need sleeps. When something fails you get a typed error that says how to fix it, plus the screenshot, trace and video.

Everything included

The whole Playwright, the BoxLang way.

Browser testing, automation and rendering in one module, with a CLI that installs everything it needs.

A fluent DSL

The playwright() BIF, smart selectors (CSS, @testId or the text a user sees) and chainable actions. browse() cleans up for you.

Web-first assertions

Inline (assertSee(), assertPathIs()) or expect() style. Both retry until the page is ready, with soft assertions when you want every failure at once.

Profiles and devices

playwright( [ "mobile", "dark" ] ). Built-in browsers, screens, devices and modes, plus your own in boxlang.json and BX_PLAYWRIGHT_* overrides.

PDFs and images

bx:playwrightRender and render() turn HTML into PDF, PNG, JPEG or WebP with a real browser: modern CSS, web fonts and JavaScript included.

Network and APIs

Mock, block and inspect requests with intercept(). Test HTTP APIs with request(). Save a login once and reuse it with session().

Visual regression

assertScreenshotMatches() keeps baselines and writes a diff image with every changed pixel in red when the page drifts.

Quality checks

axe-core accessibility audits, console error checks and smoke tests, one method call each.

Page objects and macros

Keep tests readable with page objects, reusable page components and your own macros on every page.

Any test framework

Works in TestBox or any runner. Artifact policies keep screenshots, traces and videos of failed tests, and show-trace replays them.

The bxPlaywright CLI

install, doctor, codegen, screenshot, pdf, show-trace and mcp, with bash completions and --json output.

Record BoxLang code

bxPlaywright codegen opens a browser, records your clicks and writes bx-playwright code for you.

Pure JVM, no Node project

Built on Playwright for Java. The driver is managed for you, and Node.js is found, downloaded or bundled: you never write a package.json.

Built for AI agents

Let your agent see the app it builds.

An agent that writes code but never runs the app is guessing. With bx-playwright it builds a feature, uses it in a real browser, fixes what is broken, and leaves browser tests behind.

Works with
page.snapshot( options = { mode : "ai" } )
- heading "Sign in" [level=1] [ref=e2]
- textbox "Email" [ref=e5]
- textbox "Password" [ref=e6]
- button "Sign in" [ref=e7]

Snapshots with refs

A compact, token-efficient view of the page. Agents act on refs directly: click( "ref=e7" ).

Browser tools for BoxLang AI

aiTools() gives any bx-ai agent ten browser tools: visit, snapshot, click, fill, select and more.

Playwright MCP

bxPlaywright mcp starts Playwright's MCP server for Claude, Cursor, VS Code and every MCP client.

An API that explains itself

help() on every object, typed errors with the fix in detail, and these docs as llms.txt.

Official Agent Skills

npx skills add ortus-boxlang/skills/boxlang-modules/bx-playwright teaches Claude Code, Cursor and other coding agents how to browse, assert, mock, render and test with bx-playwright.

Two distributions

Small and nimble, or everything in the box.

Same module, same API. Pick the one that fits how you deploy.

bx-playwright

About 4 MB. Uses a Node.js 20+ already on the machine, or bxPlaywright install downloads and verifies one for your platform.

bx-playwright-full

Bundles Node.js for every platform. Nothing else to download except the browsers: ideal for locked-down and air-gapped servers.

$install-bx-module bx-playwright|install-bx-module bx-playwright-full
Part of the BoxLang ecosystem

Not a one‑off tool. A whole platform.

Free & open source

Your first browser test in a minute.

Install the module, run bxPlaywright install, and drive a real browser from your next BoxLang script.

Professional open source

Free to use, backed by the team that builds it.

Ortus Solutions offers support, training and consulting for test automation, browser testing strategy, CI pipelines and BoxLang applications.