Sunday, August 23, 2026

Playwright CLI vs standard cli

 Playwright-cli is a terminal-native command-line interface specifically built for AI coding agents to control web browsers. Developed by Microsoft as part of the official Playwright project, it allows terminal-based AI tools to click buttons, take screenshots, navigate pages, and extract data using lightweight shell commands rather than heavy API integrations. [1, 2, 3]  

Why  Was Built 

Before its launch, AI agents used the  Model Context Protocol (MCP)  to automate browsers. However, MCP is highly "token-hungry" because it continuously feeds large tool schemas and verbose webpage details into the AI's limited context window. [3, 4]  

The new  fixes this by introducing Skill-Based Workflows. Instead of sending massive webpage structures back and forth, the agent runs concise terminal commands, saving up to 70–80% on AI token costs. [3, 5, 6]  

Standard CLI () vs. New CLI () 

It is important not to confuse the new agent-focused tool with the traditional developer CLI: [6]  


| Feature | Standard CLI () | New Agent CLI ()  |

| --- | --- | --- |

| Target User | Human developers | AI Coding Agents (e.g., Claude Code, Copilot, Cursor)  |

| Primary Use | Running end-to-end test suites and debugging | Browser exploration and live UI automation  |

| Output Type | Human-readable test reports and code generation UI | Machine-readable YAML snapshots and local files  |

| Token Impact | None | Exceptionally low (saves heavy files to disk instead of LLM context)  |


How It Works (The Core "Skills") 

When you install the CLI, you can generate a  file using the command . This file functions as onboarding documentation that teaches the AI agent exactly what commands it is allowed to run. [3, 7]  

Common terminal actions include: 


• Opening a page:  

• Clicking an element:  

• Capturing the state:  

• Taking a visual check:  [6, 7]  


How to Install It 

The CLI can be installed globally via Node.js package manager: [8]  

Are you trying to configure  to work with a specific AI coding agent (like Claude Code or Cursor), or are you looking for traditional Playwright commands to run your own automated tests? 

AI responses may include mistakes.


[1] https://playwright.dev/agent-cli/introduction

[2] https://playwright-cli.com/

[3] https://www.youtube.com/watch?v=OaFmRHiKp68

[4] https://www.youtube.com/watch?v=CVxEOfGu7Nw

[5] https://playwright.dev/python/docs/getting-started-cli

[6] https://testdino.com/blog/playwright-cli

[7] https://testcollab.com/blog/playwright-cli

[8] https://playwright.dev/docs/getting-started-cli


What are Playwright Agents

 Playwright Agents are Large Language Model (LLM)-driven AI tools embedded natively into the Playwright test automation framework. Released in late 2025 (v1.56), they shift the testing paradigm from manually writing hardcoded test scripts ("how" to test) to describing goals in natural language ("what" to test).Unlike generic code generation tools that predict code based on abstract training data, Playwright Agents interact with real, live browser sessions, inspecting the actual Document Object Model (DOM) and accessibility trees to plan, write, and execute tests.The Three Core Playwright AgentsPlaywright comes with three specialized built-in agents that work independently, sequentially, or together in an autonomous "agentic loop" to handle the full testing lifecycle:🎭 Planner: Explores your live application URL and builds a structured test plan in Markdown format, identifying core user paths and edge cases.🎭 Generator: Reads the Markdown test plans created by the Planner and automatically converts them into fully executable, real Playwright test files (.spec.ts) containing proper selectors and assertions.🎭 Healer: Monitors the execution of the test suite. If a test fails due to a UI change or broken locator, the Healer replays the steps, identifies the change, suggests a patch, and repairs the test autonomously.Architecture and Integration OptionsPlaywright supports two distinct approaches for connecting Large Language Models to web automation:Playwright Model Context Protocol (MCP): Best for specialized agentic loops and exploratory automation. It allows LLMs to persistently inspect page structures, but has a higher token consumption cost due to rich context payloads.Playwright CLI: Designed for coding assistants (like GitHub Copilot or Claude Code). It is highly token-efficient, leveraging concise command-line tools and loaded skills on demand rather than heavy DOM schemas.Key BenefitsSelf-Healing Capabilities: Reduces test suite maintenance by fixing broken CSS/XPath selectors automatically when UI layouts change.Accelerated Bootstrapping: Speeds up development by converting high-level intent into working TypeScript tests in seconds.Real-world Verification: Operates within actual browser environments, executing and validating assertions against live DOM states.If you want to try them out, let me know:Which programming language or framework flavor you are using.Your current code editor (e.g., VS Code).If you want a quick setup guide to configure your first agentic loop.



Thursday, August 20, 2026

Is Playwrite MCP server is safe w.r.to Data?

 Yes, the Playwright Model Context Protocol (MCP) server primarily operates via standard input/output (stdio) and runs completely locally on your machine without connecting to any external cloud-hosted servers.However, because its core purpose is browser automation, the browser instance it controls will connect to external web servers whenever you command it to navigate to a live website.🌐 Understanding How Playwright MCP ConnectsLocal stdio Architecture: When configured in AI applications like Claude Desktop, Cursor, or GitHub Copilot CLI, the server runs entirely as a local sub-process. Communication between your AI app and the Playwright tool occurs over your computer's local stdin and stdout channels. No data from this communication channel is broadcast to the internet.Optional Local Network Modes: The Playwright MCP server can also be configured to run as a local HTTP/SSE server. Even in this mode, it is hosted locally on your device (localhost), though it is accessible to other local IDE tools or custom clients.Browser Internet Traffic: While the MCP connection itself is entirely isolated, the Playwright browser instance (Chromium/Chrome) will connect to external servers whenever the AI instructs it to browse a live URL (e.g., executing a command to scrape data from an external website or test an online application).🛡️ Enterprise Security & Data IsolationBecause it operates locally via stdio, none of your local application context, files, or login tokens are transmitted to an external MCP provider hosting server.However, you should keep the following two data flows in mind:The AI Model Provider: Any text, code, or page data that the Playwright MCP server scrapes from your browser window is fed back into your AI client, which then sends it to your AI provider (like Anthropic or OpenAI) to analyze the page content.Local Application Isolation: If you instruct the AI to browse a local development server (http://localhost:3000), the network traffic remains entirely within your local machine.Would you like assistance configuring the claude_desktop_config.json file to run Playwright MCP locally via stdio, or are you looking to restrict the browser from accessing specific external domains?

Playwright MCP server

 Introduction

The Playwright MCP server provides browser automation capabilities through the Model Context Protocol, enabling LLMs to interact with web pages using structured accessibility snapshots. It works with VS Code, Cursor, Windsurf, Claude Desktop, and any other MCP client — no vision models required.

Prerequisites

Before you begin, make sure you have the following installed:


Node.js 20 or newer

An MCP client: VS Code, Cursor, Windsurf, Claude Code, Claude Desktop, or similar

Getting Started

Installation

Add the Playwright MCP server to your client using the standard configuration:

{

  "mcpServers": {

    "playwright": {

      "command": "npx",

      "args": [

        "@playwright/mcp@latest"

      ]

    }

  }

}


VS Code

Click one of the buttons below to install directly:

Install in VS Code Install in VS Code Insiders

Or install via the VS Code CLI:

code --add-mcp '{"name":"playwright","command":"npx","args":["@playwright/mcp@latest"]}'

Cursor

Install in Cursor

Or go to Cursor Settings → MCP → Add new MCP Server and use command type with npx @playwright/mcp@latest.

Claude Code

claude mcp add playwright npx @playwright/mcp@latest

Claude Desktop

Follow the MCP install guide and use the standard config above.

Other clients

The standard configuration works with most MCP clients, including Windsurf, Cline, Goose, Kiro, Codex, Copilot CLI, and others. Consult your client's MCP documentation for where to place the config.

First interaction

Once the server is connected, ask your AI assistant to interact with a web page:

Navigate to https://demo.playwright.dev/todomvc and add a few todo items.

The assistant will use Playwright MCP tools to open the browser, navigate to the page, and interact with elements — all through structured accessibility snapshots rather than screenshots.

Core Features

Accessibility snapshots

Playwright MCP operates on the page's accessibility tree, not pixels. When a tool runs, it returns a structured snapshot showing the page elements, their roles, and text content. The LLM uses element references from these snapshots to interact with the page:

- heading "todos" [level=1]

- textbox "What needs to be done?" [ref=e5]

- listitem:

  - checkbox "Toggle Todo" [ref=e10]

  - text: "Buy groceries"

The LLM reads this snapshot and uses ref=e5 to type into the textbox or ref=e10 to check the checkbox.

Interacting with pages

Playwright MCP provides tools for all common browser interactions:

Navigation: Open URLs, go back/forward, reload pages.

Clicking and typing: Click elements, type text, fill forms, select dropdowns.

Screenshots: Capture the current page or specific elements for visual verification.

Keyboard and mouse: Press keys, hover, drag and drop.

Dialogs: Accept or dismiss browser dialogs.

Tabs: Create, close, and switch between browser tabs.

Running Playwright code

For complex interactions that go beyond individual tool calls, use the browser_run_code_unsafe tool to execute Playwright scripts directly. This tool runs arbitrary JavaScript in the Playwright server process and is RCE-equivalent — only enable it for trusted MCP clients:


Run this Playwright code to verify the todo count:

async (page) => {

  const count = await page.getByTestId('todo-count').textContent();

  return count;

}


Network monitoring and mocking

Inspect network traffic and mock API responses:


View network requests: List all requests made since page load.

Mock routes: Set up URL pattern matching to return custom responses.

Console messages: Access browser console output for debugging.

Storage state

Save and restore browser state including cookies and localStorage:


Save state: Persist authentication and session data to a file.

Restore state: Load previously saved state into a new session.

Cookie management: List, get, set, and delete individual cookies.

Configuration

Headed mode

By default, Playwright MCP runs the browser in headed mode so you can see what's happening. To run headless:


{

  "mcpServers": {

    "playwright": {

      "command": "npx",

      "args": [

        "@playwright/mcp@latest",

        "--headless"

      ]

    }

  }

}


Browser selection

Choose which browser to use:


{

  "mcpServers": {

    "playwright": {

      "command": "npx",

      "args": [

        "@playwright/mcp@latest",

        "--browser=firefox"

      ]

    }

  }

}


Supported values: chrome, firefox, webkit, msedge.


User profile

Playwright MCP supports three profile modes:


Persistent (default): Login state and cookies are preserved between sessions. The profile is stored in ms-playwright/mcp-{channel}-{workspace-hash} in your platform's cache directory, so different projects get separate profiles automatically. Override with --user-data-dir.

Isolated: Each session starts fresh. Pass --isolated to enable. You can load initial state with --storage-state.

Browser extension: Connect to your existing browser tabs with the Playwright Extension. Pass --extension to enable.

Configuration file

For advanced configuration, use a JSON config file:


npx @playwright/mcp@latest --config path/to/config.json


The config file supports browser options, context options, network rules, timeouts, and more. See the Playwright MCP repository for the full schema.


Standalone server

When running a headed browser on a system without a display or from IDE worker processes, start the MCP server separately with HTTP transport:


npx @playwright/mcp@latest --port 8931


HTTP sessions use a five-second heartbeat timeout. If your MCP client or proxy does not answer server-initiated pings, set PLAYWRIGHT_MCP_PING_TIMEOUT_MS to a longer timeout in milliseconds. Set it to 0 to disable the heartbeat.


Then point your MCP client to the HTTP endpoint:


{

  "mcpServers": {

    "playwright": {

      "url": "http://localhost:8931/mcp"

    }

  }

}


Quick Reference

Action How to do it

Install server Add standard config to your MCP client

Navigate to a page Ask: "Go to https://example.com"

Click an element Ask: "Click the Submit button"

Fill a form Ask: "Fill in the email field with test@example.com"

Take a screenshot Ask: "Take a screenshot of the page"

Run Playwright code Ask: "Run this Playwright code: ..."

Mock an API Ask: "Mock the /api/users endpoint to return ..."

Use headed mode Default. Pass --headless to disable

Choose a browser Pass --browser=firefox in args


Tuesday, August 18, 2026

How to map Claude extension features to goals ?

 


This is best overview of how to match the goal and the features that Claude provides. 


How to extend the claude functionalities? What are diferent ways

Extensions plug into different parts of the agentic loop:

CLAUDE.md adds persistent context Claude sees every session

Skills add reusable knowledge and invocable workflows

Code intelligence connects Claude to a language server for symbol-level navigation and live type errors

MCP connects Claude to external services and tools

Subagents run their own loops in isolated context, returning summaries

Agent teams coordinate multiple independent sessions with peer-to-peer messaging, plus a shared task list for agents that have the Task tools

Hooks run your script, HTTP request, prompt, or subagent when Claude Code reaches a lifecycle event

Plugins and marketplaces package and distribute these features

Skills are the most flexible extension. A skill is a markdown file containing knowledge, workflows, or instructions. You can invoke skills with a command like /deploy, or Claude can load them automatically when relevant. Skills can run in your current conversation or in an isolated context via subagents.


Sunday, August 16, 2026

How to work effectively with Claude Code?

 Work effectively with Claude Code

These tips help you get better results from Claude Code.

Ask Claude Code for help

Claude Code can teach you how to use it. Ask questions like “how do I set up hooks?” or “what’s the best way to structure my CLAUDE.md?” and Claude will explain.

Built-in commands also guide you through setup:

/init walks you through creating a CLAUDE.md for your project

/doctor runs a setup checkup that diagnoses installation and configuration issues and can fix them

It’s a conversation

Claude Code is conversational. You don’t need perfect prompts. Start with what you want, then refine:

Fix the login bug

[Claude investigates, tries something]

That's not quite right. The issue is in the session handling.

[Claude adjusts approach]

When the first attempt isn’t right, you don’t start over. You iterate.

Interrupt and steer

You can redirect Claude at any point without waiting for the turn to finish or starting over:

Press Esc to stop Claude immediately. The running tool call is canceled and Claude waits for your next instruction.

Type a correction and press Enter to send it without stopping the running tool. Claude reads it as soon as the current action completes and adjusts before deciding its next step.

Be specific upfront

The more precise your initial prompt, the fewer corrections you’ll need. Reference specific files, mention constraints, and point to example patterns.

The checkout flow is broken for users with expired cards.

Check src/payments/ for the issue, especially token refresh.

Write a failing test first, then fix it.

Vague prompts work, but you’ll spend more time steering. Specific prompts like the one above often succeed on the first attempt.

Give Claude something to verify against

Claude performs better when it can check its own work. Include test cases, paste screenshots of expected UI, or define the output you want.

Implement validateEmail. Test cases: 'user@example.com' → true,

'invalid' → false, 'user@.com' → false. Run the tests after.

For visual work, paste a screenshot of the design and ask Claude to compare its implementation against it.

Explore before implementing

For complex problems, separate research from coding. Use plan mode (Shift+Tab twice) to analyze the codebase first:

Read src/auth/ and understand how we handle sessions.

Then create a plan for adding OAuth support.

Review the plan, refine it through conversation, then let Claude implement. This two-phase approach produces better results than jumping straight to code.

Delegate, don’t dictate

Think of delegating to a capable colleague. Give context and direction, then trust Claude to figure out the details:

The checkout flow is broken for users with expired cards.

The relevant code is in src/payments/. Can you investigate and fix it?