Builds autonomous web browsing agents with Playwright/Puppeteer, including intelligent scraping, DOM interaction, session management, and LLM-driven decision loops.
Ships in claude-skills-collection. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
| Critère | Playwright | Puppeteer | Selenium |
|---|---|---|---|
| Multi-navigateur | ✅ Chromium, Firefox, WebKit | ❌ Chrome/Edge uniquement | ✅ tous |
| Auto-wait natif | ✅ | ❌ (manuel) | ❌ (manuel) |
| Interception réseau | ✅ route() | ✅ setRequestInterception | ❌ limité |
| Support mobile | ✅ devices preset | ❌ | ❌ |
| Ecosystème / doc | Excellent (2024–2026) | Bon | Vieillissant |
Décision : Playwright par défaut sur tout nouveau projet. Puppeteer si contrainte Chrome-only ou lib existante. Selenium uniquement legacy/Java.
# Installation Playwright (Node.js)
npm init -y && npm i -D playwright
npx playwright install chromium # ou --with-deps pour CI
# Python
pip install playwright && playwright install chromium
┌───────────────────────────────────────────────┐
│ Orchestrateur │
│ (LLM : planifie, décide, retry si échec) │
└────────┬──────────────┬────────────┬──────────┘
│ │ │
Navigation Extraction Mémoire/État
(goto/click/fill) (DOM/vision) (cookies, historique)
Composants minimaux :
page.goto / click / fill / keyboardpage.$eval, locator, screenshot → LLM// Sélecteurs stables — ordre de préférence
page.getByRole('button', { name: 'Valider' }) // 1er choix
page.getByTestId('submit-btn') // 2e choix
page.getByLabel('Email') // 3e choix
page.locator('[data-id="checkout"]') // 4e choix
// Jamais : page.locator('.css-1a2b3c') // ❌ généré dynamiquement
// Auto-wait + retry inclus dans Playwright — ne pas ajouter de sleep manuel
await page.getByRole('button', { name: 'Valider' }).click()
// Shadow DOM
const shadow = page.locator('my-component').locator('pierce=button')
// iFrame
const frame = page.frameLocator('#checkout-iframe')
await frame.getByLabel('Numéro carte').fill('4111111111111111')
Utiliser les screenshots quand le DOM est insuffisant (canvas, interfaces riches, CAPTCHAs visuels lisibles).
import Anthropic from '@anthropic-ai/sdk'
const client = new Anthropic()
async function describePageAndAct(page: Page): Promise<string> {
const screenshot = await page.screenshot({ type: 'png' })
const b64 = screenshot.toString('base64')
const response = await client.messages.create({
model: 'claude-sonnet-4-6',
max_tokens: 512,
messages: [{
role: 'user',
content: [
{ type: 'image', source: { type: 'base64', media_type: 'image/png', data: b64 } },
{ type: 'text', text: 'Quelle action faut-il effectuer ensuite pour compléter le formulaire ?' }
]
}]
})
return (response.content[0] as any).text
}
Règle : vision = fallback coûteux — toujours tenter le sélecteur DOM d'abord.
// Sauvegarder l'état de session après login
await page.context().storageState({ path: 'session.json' })
// Réutiliser à la session suivante
const context = await browser.newContext({
storageState: 'session.json'
})
// TOTP (2FA) avec otplib
import { totp } from 'otplib'
const code = totp.generate(process.env.TOTP_SECRET!)
await page.getByLabel('Code OTP').fill(code)
// Playwright : stealth via playwright-extra
import { chromium } from 'playwright-extra'
import StealthPlugin from 'puppeteer-extra-plugin-stealth'
chromium.use(StealthPlugin())
// Profil réaliste
const context = await chromium.launchPersistentContext('', {
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
viewport: { width: 1366, height: 768 },
locale: 'fr-FR',
timezoneId: 'Africa/Tunis'
})
// Délais humains : randomiser, ne jamais fixer
const delay = (ms: number) => new Promise(r => setTimeout(r, ms))
await delay(500 + Math.random() * 1000)
async function withRetry<T>(fn: () => Promise<T>, maxAttempts = 3): Promise<T> {
for (let i = 0; i < maxAttempts; i++) {
try {
return await fn()
} catch (err) {
if (i === maxAttempts - 1) throw err
await page.screenshot({ path: `error_attempt_${i}.png` })
await page.reload()
await delay(2000)
}
}
throw new Error('unreachable')
}
// State machine simple
type Step = 'login' | 'search' | 'extract' | 'done'
let step: Step = 'login'
while (step !== 'done') {
switch (step) {
case 'login': await doLogin(); step = 'search'; break
case 'search': await doSearch(); step = 'extract'; break
case 'extract': await extract(); step = 'done'; break
}
}
// Playwright Test — test E2E du workflow critique
import { test, expect } from '@playwright/test'
test('workflow checkout complet', async ({ page }) => {
await page.goto('https://shop.example.com')
await page.getByRole('button', { name: 'Ajouter au panier' }).click()
await expect(page.getByText('1 article')).toBeVisible()
})
# Lancer en CI (headless, reporters JUnit)
npx playwright test --reporter=junit --output=results.xml
Monitoring : alerter si taux d'échec > 5 % sur 1 h. Versionner les snapshots DOM avec des tests de régression sur les sélecteurs clés.
page.waitForTimeout(3000) — ne jamais utiliser de sleep fixe ; utiliser waitForSelector ou les auto-waits Playwright.css-1x2y3z) — ils changent à chaque build ; toujours utiliser role, label, data-testid.try/catch + screenshot.GET /robots.txt avant d'automatiser et respecter les Crawl-delay.BrowserContext et changer seulement les cookies/state..env + dotenv, ne jamais commit session.json.@playwright/mcp) permet à Claude d'appeler directement les outils de navigation — idéal pour les agents LLM-driven sans coder les sélecteurs.locator chainables aux $ / $$ (deprecated dans les nouvelles versions).What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/claude-skills-collection:agent-browser-agent-builderfrom claude-skills-collection
npx claudepluginhub vantaflow/claude-skills-collection --plugin claude-skills-collection348 skills in this plugin
/agent-a2a-protocol-guideGuide du protocole Agent-to-Agent (A2A) de Google pour l'interopérabilité entre agents IA — découverte, communication et collaboration inter-agents, avec exemples de code, critères de décision et pièges à éviter. Se déclenche avec "A2A", "agent-to-agent", "protocole A2A", "Google A2A", "interopérabilité agents". Also triggers on "agent-to-agent protocol", "agent interoperability", "connect two agents"./agent-agent-observabilityInstrumentation technique d'un agent IA — tracing distribué des appels LLM et outils, spans, métriques custom, corrélation de logs et dashboards de supervision. Pour les alertes et garde-fous de production, voir agent-monitoring-setup. Se déclenche avec "observabilité agent", "tracing agent", "LangSmith", "Langfuse", "OpenTelemetry agent", "spans LLM", "corréler les logs agent". Also triggers on "trace my agent", "LLM tracing", "agent spans"./agent-api-caller-subagentSous-agent spécialisé dans les appels API REST/GraphQL avec retry, auth et transformation de données. Se déclenche avec "sous-agent API", "API caller agent", "agent qui appelle une API", "REST agent", "HTTP agent", "API integration subagent", "external API agent". Also triggers on "subagent that calls an API", "API calling agent", "agent HTTP requests".Other plugins' skills for the same job