🔧 AI Nachrichten Major AI platforms go down in unprecedented simultaneous outage(03.09.2026 um 17:34 Uhr)
🔧 AI Nachrichten ChatGPT, Claude, and Grok Down? Users Report Widespread Outages(03.09.2026 um 19:14 Uhr)
🔧 AI Nachrichten OpenAI Launches GPT-6 Astra, Says We May Have Entered the AGI Era(03.09.2026 um 22:08 Uhr)
🔧 AI Nachrichten Claude Comes to CarPlay as Fifth Major AI Chatbot App(05.09.2026 um 05:31 Uhr)
🔧 AI Nachrichten OpenAI’s GPT-6 Astra Is AGI, Says NVIDIA CEO Jensen Huang(07.09.2026 um 06:31 Uhr)
🔧 AI Nachrichten Blame AI companies for Mac mini and Mac Studio shortage(31.08.2026 um 10:32 Uhr)
🔧 AI Nachrichten Major AI platforms go down in unprecedented simultaneous outage(03.09.2026 um 17:34 Uhr)
🔧 AI Nachrichten ChatGPT, Claude, and Grok Down? Users Report Widespread Outages(03.09.2026 um 19:14 Uhr)
🔧 AI Nachrichten OpenAI Launches GPT-6 Astra, Says We May Have Entered the AGI Era(03.09.2026 um 22:08 Uhr)
🔧 AI Nachrichten Claude Comes to CarPlay as Fifth Major AI Chatbot App(05.09.2026 um 05:31 Uhr)
🔧 AI Nachrichten OpenAI’s GPT-6 Astra Is AGI, Says NVIDIA CEO Jensen Huang(07.09.2026 um 06:31 Uhr)
🔧 AI Nachrichten Blame AI companies for Mac mini and Mac Studio shortage(31.08.2026 um 10:32 Uhr)

🔧 Programmierung 🕛 kürzlich 5 Min Lesezeit
0

Getting Started with Claude Code and Playwright CLI: A Step-by-Step Guide

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

AI coding agents like Claude Code are changing how SDETs approach browser automation. Instead of writing every locator and assertion by hand, you can describe a test scenario in plain English and let Claude drive the browser for you. In this guide, we'll set up Claude Code with Playwright CLI — Microsoft's token-efficient, agent-friendly companion to Playwright — and run our first automated browser test.



By the end of this guide, you'll have Claude Code testing a real form on a real page, using nothing but shell commands under the hood.






Why Use Claude Code with Playwright CLI?





  • Natural language test execution: Describe what to test instead of writing every selector manually.


  • Token efficiency: Playwright CLI writes browser state to disk instead of streaming it into the AI's context on every action, which keeps sessions cheaper and longer-running.


  • No new protocol to learn: It runs as plain shell commands, the same way Claude Code already runs git or npm.


  • Skill-based workflows: Pairs directly with Claude Code Skills (more on that in a later post), so your team can reuse the exact same testing conventions across projects.


  • CI-ready: The same commands that work interactively in your terminal can run inside a pipeline.






Table of Contents




  1. Prerequisites

  2. Step 1: Install Node.js and Verify Your Environment

  3. Step 2: Install Playwright CLI

  4. Step 3: Install a Browser Engine

  5. Step 4: Install the Playwright Skill for Claude Code

  6. Step 5: Run Your First Automated Test

  7. Troubleshooting

  8. Conclusion








Prerequisites



Before you begin, make sure you have:




  • Node.js 18 or newer installed (Playwright CLI requires it; older versions can throw obscure errors).

  • Claude Code installed and authenticated. If you don't have it yet: npm install -g @anthropic-ai/claude-code

  • A terminal you're comfortable working in (iTerm2, Windows Terminal, or any modern shell).

  • A local web app or public URL you want to test against (we'll use a demo TodoMVC app for this walkthrough).








Step 1: Verify Your Environment



Start by confirming your Node.js version:




CODE
node --version







  • You need v18+. If you're on an older version, upgrade before continuing — Playwright CLI depends on newer JavaScript runtime features.

  • Also confirm Claude Code is installed and working:




CODE
claude --version






If that command isn't recognized, install it first with npm install -g @anthropic-ai/claude-code, then re-run the check.








Step 2: Install Playwright CLI



Install the CLI globally so it's available from any project:




CODE
npm install -g @playwright/cli@latest






The @latest tag pulls the newest release. For CI pipelines, consider pinning to a specific version (e.g. @playwright/[email protected]) so your pipeline doesn't break when a new version ships mid-run.

Confirm the install worked:




CODE
playwright-cli --help






You should see a list of available commands (navigate, snapshot, click, fill, screenshot, and more).








Step 3: Install a Browser Engine



Playwright CLI needs at least one browser binary to control:




CODE
npx playwright install chromium






You can swap chromium for firefox or webkit depending on which engine you want to test against.

This step downloads roughly 100–300 MB per browser, so make sure you have disk space and a stable connection.







Step 4: Install the Playwright Skill for Claude Code



This is the step most setup guides skip — and it's the one that actually makes Claude reliable with the CLI's exact command syntax instead of guessing:




CODE
playwright-cli install --skills






This drops a SKILL.md file into your Claude Code configuration that documents every available CLI command.

Without this step, Claude may occasionally hallucinate flags or fall back to running raw Playwright test scripts instead of using the CLI directly.

You only need to run this once per machine (or once per project, if you're using project-scoped skills).







Step 5: Run Your First Automated Test



Open a Claude Code session in your project directory:




CODE
claude






Now, in plain language, describe the test:




CODE
Use the Playwright CLI to open https://demo.playwright.dev/todomvc,
add a todo item called "Write blog post", and confirm it appears in the list.






Behind the scenes, Claude Code will run a sequence like this:




CODE
playwright-cli navigate https://demo.playwright.dev/todomvc
playwright-cli snapshot # saves page state to disk as YAML
playwright-cli fill e12 "Write blog post"
playwright-cli press e12 Enter
playwright-cli snapshot # verify the todo now appears








  • snapshot captures a compact accessibility-tree representation of the page and saves it to disk — Claude only reads the parts it needs, rather than the whole page being pushed into the conversation.

  • The e12 reference comes directly from that snapshot; Playwright CLI and Playwright MCP both use this referencing system, so if you've used MCP before, the mental model will feel familiar.

  • Claude will report back with a plain-language summary: whether the todo was added successfully, and what it saw in the final page state.








Troubleshooting





  • "Command not found: playwright-cli" — the global install didn't add it to your PATH. Try npx playwright-cli --help instead, or re-run the global install.


  • Claude falls back to raw Playwright scripts instead of the CLI — confirm the Skill installed correctly with playwright-cli install --skills, and restart your Claude Code session (Skills load at session start).

  • Browser fails to launch — re-run npx playwright install chromium and check you have enough disk space.

  • Tests behave differently on your CI server — pin your Playwright CLI and browser versions explicitly rather than relying on @latest.








Conclusion



You now have Claude Code and Playwright CLI working together, with Claude driving a real browser through natural language instructions instead of you hand-writing every step. This is just the foundation — in the next post, we'll compare Playwright CLI against Playwright MCP in detail, including real token benchmarks, so you know exactly when to reach for each one.



Have you tried Claude Code for browser testing yet? Drop your experience — or questions — in the comments below!

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
3 Quellen
GPT-6 Astra Release Today? OpenAI’s Next Major AI Model Is Almost Here
1 Quelle
Apple accuses OpenAI of destroying evidence as trade-secrets fight intensifies
1 Quelle
Major AI platforms go down in unprecedented simultaneous outage
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Getting Started with Claude Code and Playwright CLI: A Step-by-Step Guide

Thematisch verwandte Begriffe: Getting, Started, with, Claude · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...