localhost:19988 and only accepts connections from the extension. No traffic leaves the machine unless you explicitly enable Remote control or configure remote access.┌──────────────────────────────────────────────────────────────────────────────────────────┐ │ YOUR MACHINE │ │ │ │ ┌─────────────┐ ┌──────────────────┐ ┌──────────────┐ │ │ │ Extension │ <────────> Relay Server │<────────> CLI / MCP │ │ │ │ (Chrome) │ WS │ localhost:19988 │ WS │ (Agent) │ │ │ └─────────────┘ └──────────────────┘ └──────────────┘ │ │ │ │ Nothing leaves localhost unless you explicitly enable a remote feature │ └──────────────────────────────────────────────────────────────────────────────────────────┘
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.context.newPage(). Playwriter does not attach to other existing tabs in the background.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.https://playwriter.dev/remote-control#{id}. The initial viewer-page request and Referer omit the fragment. The viewer then uses the id to connect to the tunnel hostname, which the tunnel service and Cloudflare necessarily process.--token flag on playwriter serve enforces auth on all connections.# 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
POST /recorder/start.chrome-extension:// to 127.0.0.1). /recorder/start and /recorder/stop skip the Sec-Fetch-Site block for that reason. /recorder/events and /recorder/status do not.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.const 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 }) }