Skip to main content
Headless Chromium does not require GPU acceleration. This example uses Microsoft’s Playwright image to capture a screenshot and optionally run a persistent browser server for a host-side test runner or agent.
The Playwright image is large. Its first pull can take several minutes, while cached browser launches are much faster. Consider turning a prepared browser sandbox into a snapshot for repeated jobs.

Use Playwright

1

Capture a screenshot

Copy the artifact out of the stopped sandbox:
The smoke test used for this example produced a valid 15,909-byte PNG. Rendering can vary slightly between releases and hosts, so verify the file rather than asserting an exact byte count.
2

Optional: run a remote server

Verify the forwarding path:
The server returns Running and logs its WebSocket endpoint:
Connect a matching Playwright client to ws://127.0.0.1:3000/. Keep the client and server versions aligned.
The remote server has no application-level authentication. This example binds the host side to loopback intentionally. Do not publish it on 0.0.0.0 or an internet-facing interface without an authenticated proxy.
3

Clean up

Remove the sandboxes:
Delete the copied screenshot only if you no longer need it:

Reference