How to set up Playwright CLI in Claude Code and Codex

Playwright CLI gives your AI a real browser, so it can click through your site and tell you what's broken.

By Matias Barragan Free guide 3 min read Updated

The steps to set up Playwright CLI: install it, add its skill, ask your AI to check your site.

What is Playwright CLI?

Playwright CLI is a free, open-source tool from Microsoft that lets your AI drive a browser from the terminal. It opens pages, clicks, types, takes screenshots and reads the errors your site prints in the browser console.

It's the check you'd do by hand after every change, done by your AI. The browser runs hidden, so no window pops up unless you ask for one.

Step 1: Install it

You need Node.js 18 or newer. Install the tool once for your whole computer:

npm install -g @playwright/cli@latest

Then, inside your project folder, add its skill so Claude Code knows the commands:

playwright-cli install --skills

This adds one skill to .claude/skills/playwright-cli in that project.

Step 2: Ask your AI to check your site

Open your project in Claude Code or Codex and paste one of these, with your own address:

Use playwright-cli to open https://yoursite.com and list every console error.
Use playwright-cli to open my homepage at 390 by 844, a phone-sized screen, and take a screenshot.
Use playwright-cli to click every link in my menu and tell me which ones lead to a missing page.

Screenshots and page notes are saved in a .playwright-cli folder in your project. Add --headed to the open command when you want to watch the browser.

What should you watch out for?

Your AI clicks what you tell it to. On your live site, a test form it sends or a test order it places is real, so say "don't submit anything" or test on a copy of your site.

It sees what a visitor sees, so it won't find problems on your server, like a slow database.

Let your AI check your whole site

The SEO Kit runs in Claude Code or Codex, on your computer. It checks every page of your site and writes new titles and descriptions for you to approve.

See The SEO Kit
All guides