localhost:19988 and only accepts connections from the extension. No remote server, no account, no telemetry.┌──────────────────────────────────────────────────────────────────────────────────────────┐ │ YOUR MACHINE │ │ │ │ ┌─────────────┐ ┌──────────────────┐ ┌──────────────┐ │ │ │ Extension │◄────────► Relay Server │◄────────► CLI / MCP │ │ │ │ (Chrome) │ WS │ localhost:19988 │ WS │ (Agent) │ │ │ └─────────────┘ └──────────────────┘ └──────────────┘ │ │ │ │ Nothing leaves localhost unless you explicitly set up remote access │ └──────────────────────────────────────────────────────────────────────────────────────────┘
Origin header, so malicious websites cannot connect and control your browser. CLI and MCP connect as local Node.js clients on localhost; for remote access, always use token authentication.require('node:fs') module in the execution sandbox is scoped. Write operations only succeed in:| Allowed path | Description |
| Session cwd | The directory where playwriter CLI was invoked |
/tmp | System temp directory |
os.tmpdir() | OS-specific temp (e.g. /var/folders/.../T/ on macOS) |
EPERM: operation not permitted, access outside allowed directories. To save files elsewhere, write to a temp path first, then move the file using a shell command outside the sandbox.import statements. Use require() for Node.js modules.__dirname or __filename. Use process.cwd() or absolute paths.require. Only safe Node.js built-in modules are available: path, url, querystring, crypto, buffer, util, assert, events, timers, stream, zlib, http, https, os, and scoped fs.process.chdir(). Use a new session with a different cwd.browser.close() or context.close(). These would disconnect all agents.--token flag on playwriter serve enforces auth on all connections.1234567# Host machine: serve with auth token npx traforo -p 19988 -- playwriter serve --token MY_SECRET # Remote machine: connect with token export PLAYWRITER_HOST=https://my-tunnel.traforo.dev export PLAYWRITER_TOKEN=MY_SECRET playwriter session new
Network.clearBrowserCookies via CDP. It's a profile-wide destructive operation that wipes ALL cookies across every domain in the user's Chrome profile; Gmail, GitHub, and every authenticated session.1234567891011const cdp = await getCDPSession({ page: state.page }) const { cookies } = await cdp.send('Network.getCookies', { urls: ['https://example.com'] }) // Delete individually for (const cookie of cookies) { await cdp.send('Network.deleteCookies', { name: cookie.name, domain: cookie.domain }) }