Documentation
Installation
npm install -g trywright Requires Node.js 20 or higher. Chromium, Firefox, and WebKit browser binaries are downloaded automatically as part of npm install. If you already have Playwright installed, see Existing Playwright installation for what to expect.
If the browser install step was skipped or failed, run it manually:
npx playwright install First session
trywright start This starts the daemon in the background. It does not open the browser automatically. Use trywright open to open the UI, or navigate to http://localhost:3333 yourself. Then enter any URL in the URL bar and click Launch to start a browser session.
On first start, Trywright also registers itself as a login startup item so the daemon runs automatically after a reboot.
# Start daemon, then open the UI in one step:
trywright open
# Or pre-fill a URL:
trywright open https://example.com The UI tour
The UI is split into two halves: a preview pane on the left and a panel on the right with four tabs.
| Tab | What it does |
|---|---|
REPL | Type any Playwright expression and see the result. page is always the active page object. |
Console | Captures console.log, console.error, and network errors from the page. |
API | Searchable reference of every page method, with examples. Click a method to insert it into the REPL. |
Config | Session settings: browser choice, headless/headed mode, viewport preset, timeouts, and screenshot FPS. |
trywright start
Start the Trywright daemon in the background.
trywright start [--foreground] | Flag | Description |
|---|---|
--foreground | Run in the foreground (blocking). Useful for seeing daemon logs directly in the terminal. |
trywright stop
Stop the running daemon. Reads the PID from ~/.config/trywright/daemon.pid and sends SIGTERM.
trywright stop trywright open
Open the UI in your default browser. Starts the daemon first if it isn't already running.
trywright open [url] # Examples:
trywright open
trywright open https://example.com trywright status
Show whether the daemon is running and list any active Playwright sessions.
trywright status trywright cleanup
Close all active Playwright browser sessions without stopping the daemon.
trywright cleanup trywright uninstall
Stop the daemon and remove the login startup item registered on first run. Does not uninstall the npm package itself.
trywright uninstall To fully remove Trywright after running this command:
rm -rf ~/.config/trywright
npm uninstall -g trywright How the REPL works
page is always the active Playwright Page object for the current session. await is implicit — you don't need to write it. Every expression is evaluated in a Node.js VM context with the live Playwright session in scope.
// These all work:
page.title()
page.url()
page.locator('h1').textContent()
page.evaluate(() => document.title) Each command runs independently. The REPL evaluates one expression at a time — multi-line input is not supported.
Return types
Results are displayed based on their type:
| Type | Display |
|---|---|
| String | Shown in quotes |
| Number, boolean | Shown as-is |
| Object / array | JSON-formatted |
undefined (void) | Shown as undefined |
| Error | Red error message |
Command history
Previous commands are shown above the input. Each entry shows the command, its result or error, and the time it ran. History is kept for the lifetime of the session — it clears when the session is closed.
Keyboard shortcuts
| Shortcut | Action |
|---|---|
| Enter | Run the expression |
| ↑ / ↓ | Navigate command history |
config.json location
Trywright reads its configuration from:
~/.config/trywright/config.json The file is created automatically on first run with all defaults. Edit it by hand — changes take effect on the next daemon start.
All options and defaults
{
"port": 3333,
"maxSessions": 3,
"defaultMode": "headless",
"defaultBrowser": "chromium",
"screenshotFps": 10
} | Option | Type | Default | Description |
|---|---|---|---|
port | number | 3333 | Port the daemon HTTP/WebSocket server listens on. |
maxSessions | number | 3 | Maximum concurrent Playwright browser sessions. |
defaultMode | string | "headless" | Pre-selected mode when the UI loads. "headless" or "headed". |
defaultBrowser | string | "chromium" | Pre-selected browser when the UI loads. "chromium", "firefox", or "webkit". |
screenshotFps | number | 10 | Screenshot streaming rate in headless mode (frames per second). |
Installing browsers
Browser binaries are installed automatically when you install Trywright. If you need to reinstall them:
# Install all three browsers
npx playwright install
# Install a specific browser
npx playwright install chromium
npx playwright install firefox
npx playwright install webkit Binaries are stored in Playwright's default cache directory, typically ~/.cache/ms-playwright on Linux/macOS.
Chromium
The default browser. Best overall compatibility with the modern web. Playwright ships its own Chromium build rather than using an installed Chrome — behaviour is deterministic and independent of your system browser.
Firefox
Use Firefox sessions to test Gecko-engine rendering and JavaScript behaviour. Useful for catching issues that only surface in non-Chromium browsers.
WebKit
The engine behind Safari. WebKit on Playwright runs on all platforms — you don't need a Mac to test Safari behaviour. Particularly useful for finding iOS/Safari regressions before they reach production.
Command not found after install
If your terminal shows command not found: trywright after running npm install -g trywright, the npm global bin directory is not in your shell's PATH.
Find where npm puts global binaries:
npm config get prefix
# e.g. /Users/you/.npm-global or /usr/local The trywright binary will be inside the bin/ subdirectory of that path. Add it to your shell profile.
For zsh (default on macOS since Catalina) — add to ~/.zshrc:
export PATH="$(npm config get prefix)/bin:$PATH" For bash — add the same line to ~/.bashrc or ~/.bash_profile.
After saving the file, reload your shell:
source ~/.zshrc # or source ~/.bashrc Then verify:
trywright --version Note: if you installed Node via nvm, Homebrew, or the official nodejs.org installer, the binary is almost certainly already in PATH — restart your terminal first before trying the steps above.
Existing Playwright installation
Trywright ships its own copy of Playwright as a dependency. If you already have Playwright installed, here is what happens:
Same version: Playwright stores browser binaries in a shared cache (~/.cache/ms-playwright on macOS/Linux) keyed by browser revision. If the revision matches, nothing is re-downloaded. Install is instant.
Different version: Each Playwright version maps to specific browser revision numbers. If your existing Playwright is a different version to trywright's bundled one, the browser revisions differ. Trywright's npm install step will download its own revision alongside your existing ones. Both coexist in the cache — your Playwright projects are not affected.
In either case, trywright uses its own bundled Playwright internally and does not touch your project's node_modules or lock files.
Security model
Trywright is a local-only developer tool. The daemon listens exclusively on localhost and is never exposed to the network. Several layers of protection are active by default:
| Protection | What it does |
|---|---|
| Localhost-only access | The daemon rejects CORS requests from any non-localhost origin. Remote pages cannot reach the API even if the machine is reachable on a network. |
| URL protocol validation | The API refuses to open file://, javascript:, data:, and vbscript: URLs. Only http:// and https:// are accepted. |
| Security headers | All API responses include Content-Security-Policy, X-Content-Type-Options: nosniff, and X-Frame-Options: DENY. |
| REPL sandboxing | REPL expressions have access to the Playwright page API only. waitFor* methods are blocked — they hang indefinitely in single-shot eval mode and are rejected with a clear error before evaluation. |
| No outbound telemetry | Trywright makes no network calls outside of the browser sessions you explicitly open. No analytics, no crash reporting, no license checks. |
Because Trywright runs entirely on your machine, the security posture is the same as any other local dev tool (like a local database GUI or a dev server). The attack surface is limited to processes already running on your machine.
Reporting a vulnerability
If you discover a security issue, please report it privately rather than opening a public issue. Open a confidential GitHub issue at github.com/abhivaikar/trywright-issues and mark it as a security report, or reach out directly via the contact on that repository.
Please include a description of the issue, steps to reproduce, and any relevant environment details (OS, Node.js version, Trywright version). We aim to acknowledge reports within 48 hours and ship a fix as quickly as possible.