Sign inSign up
playwright logo

sbx/playwright

Verified Publisher

By Docker, Inc

•Updated 1 day ago

Playwright CLI and test runner with headless Chromium for sandbox agents

Sandbox Kit
0

10K+

sbx/playwright repository overview

Digest

sha256:60aa158506a3…

Size

4.8 MB

Schema

v3

Pushed

1 day ago

Specificationspec.yaml

MIXIN

Playwright CLI and test runner with headless Chromium for sandbox agents


Arguments
NameRequiredDefaultDescription
nodeVersionOptional24

DHI Node.js major to install only when Node is absent

Options: 22, 24, 26
versionRequired—

Playwright release carried by the DHI package



CapabilitiesExpand a row to see its full configuration. See the full spec for the complete descriptor.
TypeRequiredDescription
com.docker.sandbox/network-policy@1Required—
com.docker.sandbox/lifecycle@1Required—
com.docker.sandbox/agent-context@1Optional—
com.docker.sandbox/agent-context@2Optional—

Requiresdeb/apt, deb/bash, deb/coreutils, deb/grep

Apply this mixin to a sandbox

sbx run <agent> --kit sbx/playwright:latest

Make sure you have docker sbx installed

Run the following command to install sbx on your machine.

macOS
brew install docker/tap/sbx
Windows
winget install Docker.sbx
Learn more about docker sbx⁠

⁠Playwright for Docker Sandboxes

This v3 mixin Kit adds the Playwright⁠ CLI, @playwright/test, and headless Chromium to a compatible Debian 13 workload. It composes with agent workloads such as Claude Code⁠ and Shell⁠.

This Kit is built on Docker Hardened Images.

⁠Use

Add --kit sbx/playwright when creating your sandbox. The Kit keeps the workload's command, user, home directory, and package database.

sbx run sbx/claude --kit sbx/playwright

Run playwright --version, then npx playwright test in your project. For browser scripts, use const { chromium } = require('playwright'). NODE_PATH makes the global packages available even without a local package.json. Projects with local dependencies use their own packages.

The driver and matching test runner arrive in the Kit. Sandbox creation installs Chromium, its headless shell, and native libraries through apt. The browser follows the distribution's Chromium security updates rather than a bundled Chrome-for-Testing build. The workload needs apt, Bash, and access to its configured package repositories.

⁠Choose a Node.js fallback

The Kit preserves Node.js when the workload or another Kit already supplies it. That interpreter must meet Playwright's Node.js 20 or newer requirement. The Kit installs npm and npx independently when missing.

ArgumentDefaultValuesMeaning
nodeVersion2422, 24, 26DHI Node.js major to install when Node.js is absent. An existing interpreter is preserved.

For example, add --kit-arg nodeVersion=22 when creating the sandbox.

sbx run sbx/claude --kit sbx/playwright --kit-arg nodeVersion=22

⁠Run browsers

Chromium runs headlessly. Screenshots, PDFs, traces, and videos work without a display server. Headed mode, codegen, and the UI runner need a display server that you supply. Firefox and WebKit are not provisioned.

Keep PLAYWRIGHT_BROWSERS_PATH=/opt/ms-playwright. This shared directory is writable by the agent. If your project pins a different Playwright release, run npx playwright install chromium to download its matching browser. Downloading Firefox or WebKit alone does not install their additional native libraries.

Browser CDN hosts are allowed at runtime. Package repositories are allowed during installation. Sites under test need their own network policy grants. Installing project npm dependencies also needs the registry hosts your project uses.

⁠References

See the Sandbox Kit v3 specification⁠, Playwright documentation⁠, and Docker Hardened Images documentation⁠.