Skip to content

Add example: live Playwright browser feed via noVNC#95

Open
Desperado wants to merge 2 commits into
e2b-dev:mainfrom
Desperado:add-playwright-live-vnc-feed
Open

Add example: live Playwright browser feed via noVNC#95
Desperado wants to merge 2 commits into
e2b-dev:mainfrom
Desperado:add-playwright-live-vnc-feed

Conversation

@Desperado

Copy link
Copy Markdown

Adds a second cookbook example showing how to stream a headed Playwright test from an E2B sandbox to a browser tab via noVNC.

What it shows

  • Boot Xvfb + x11vnc + websockify + noVNC inside a fresh playwright-chromium sandbox.
  • Get the public noVNC URL from sandbox.getHost(6080) — TLS terminates at E2B's edge, so the URL is always https://.
  • Run a headed Playwright test against DISPLAY=:99 so x11vnc captures the rendered surface.
  • Hold the sandbox alive after the run so the browser tab can still display the final (or broken) page state.

Structure

  • src/vnc-setup.ts — sandbox creation + VNC stack boot, returns the noVNC URL.
  • src/runner.ts — headed Playwright runner targeting the live display (headless: false, slowMo: 250, viewport matched to the Xvfb screen size).
  • examples/01-watch-live-test.ts — happy-path demo against playwright.dev.
  • examples/02-hold-on-failure.ts — pause-on-failure pattern: sandbox stays alive long enough for the operator to reload the noVNC URL and visually diagnose what went wrong.

Related

Complements #93 (self-healing-playwright-tests). The two patterns are complementary:

  • self-healing snapshot → tells the LLM what the DOM was at failure
  • live VNC feed → tells the human watching what the page looked like

The self-healing example's README cross-links here for users who want both.

Verified

  • npm install clean.
  • npm run typecheck clean.
  • Same VNC stack used in production at qualitymax.io for the execution-view "Live" tab; trimmed to a self-contained cookbook example.

Also adds one bullet to the root README's "Example use cases" section.

Run a headed Playwright test inside an E2B sandbox and watch the
browser drive itself in real time from any tab. Boots
Xvfb + x11vnc + websockify + noVNC inside the sandbox, exposes port
6080 via sandbox.getHost(6080), returns a https:// URL the operator
opens in a browser tab.

Two runnable scripts:
- examples/01-watch-live-test.ts -- passing test against playwright.dev,
  prints URL, holds sandbox after the run so the final state stays
  visible in the noVNC tab.
- examples/02-hold-on-failure.ts -- pause-on-failure pattern. Deliberately
  failing test, sandbox kept alive long enough for the operator to
  reload the noVNC URL and visually diagnose what went wrong.

Same VNC stack that powers the qualitymax.io execution-view "Live"
tab, trimmed to a self-contained cookbook example. Complements the
self-healing example (PR e2b-dev#93): the snapshot pattern tells the LLM
what the DOM was at failure, the live feed tells the human watching
what the page looked like.

typecheck clean.
@cla-bot

cla-bot Bot commented May 13, 2026

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement, and we don't have @Desperado on file. You can sign our CLA at https://e2b.dev/docs/cla . Once you've signed, post a comment here that says '@cla-bot check'

@Desperado

Copy link
Copy Markdown
Author

@cla-bot check

@cla-bot cla-bot Bot added the cla-signed label May 13, 2026
@cla-bot

cla-bot Bot commented May 13, 2026

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant