arrow-left Back to topicQuizCoding agentsCheck yourself1.What's the main advantage of playwright-cli over Playwright MCP for coding agents?playwright-cli supports more browsers than MCPplaywright-cli uses fewer tokens — concise commands and minimal output instead of full accessibility treesplaywright-cli is faster because it doesn't use a browser2.How do browser sessions work in playwright-cli within a single session?Each command opens a fresh browser with no cookies or localStorageBrowser state (cookies, localStorage) persists between commands within a session but resets when the browser closesAll state is stored on disk and persists indefinitely until manually clearedSessions in playwright-cli are stateless — you must pass auth tokens with every command3.What is the difference between 'playwright-cli snapshot' and 'playwright-cli screenshot'?snapshot saves a full HTML file; screenshot saves a PNG — both are for human reviewsnapshot outputs a structured text representation of page elements (for agent reasoning); screenshot saves a visual PNG image (for human review or visual comparison)They are identical — 'snapshot' is just an alias for 'screenshot'snapshot captures network requests; screenshot captures the DOM4.After running 'playwright-cli snapshot', you see output like '[e15] Create order button'. How do you click that element?playwright-cli click "Create order button"playwright-cli click e15playwright-cli click --ref=e15playwright-cli click "role=button[name=Create order]"5.What does 'playwright-cli show' open?A terminal dashboard listing all CLI commands and their usageA visual browser dashboard showing all running sessions with live screencasts, where you can take over mouse and keyboard controlThe Playwright HTML test report for the last test runA JSON file with the current page state and active sessions6.When should you choose playwright-cli over writing standard Playwright tests?Always — playwright-cli is a superset of Playwright tests and replaces them entirelyWhen a coding agent needs to occasionally check browser state while working on a codebase — playwright-cli keeps token cost lowOnly for mobile device testing — playwright-cli has better mobile support than standard PlaywrightWhen tests need to run in parallel — playwright-cli handles parallelism automatically7.How do you install playwright-cli and then install skills for better agent context?npm install playwright-cli && playwright-cli --setupnpm install -g @playwright/cli@latest && playwright-cli install --skillsnpx @playwright/mcp@latest install && mcp install --skillsnpm install @playwright/test && playwright install --skills8.You want an agent to test multiple users simultaneously — admin and a regular user — in isolated browser contexts. How do named sessions help?Named sessions are not possible — playwright-cli only supports one browser at a timeUse 'playwright-cli -s=admin' and 'playwright-cli -s=user' — each named session runs its own isolated browser with separate cookies and localStorageOpen two terminal windows and run playwright-cli in each — they automatically use different browsersPass --isolated to playwright-cli open to create a new incognito context each timeSubmit answersarrow-left PreviousAccessibility testingPlaywright MCPNext arrow-right