{
 "kind": "tool",
 "slug": "playwright-test",
 "path": "tools/playwright-test/",
 "name": "Playwright (JavaScript)",
 "maker": null,
 "density": "full",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "Testing",
   "tools/testing/"
  ]
 ],
 "lead": "Check your site in real browsers.",
 "chips": [
  {
   "label": "Testing",
   "path": "tools/testing/"
  },
  {
   "label": "NPM"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "npm install @playwright/test"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/microsoft/playwright"
  },
  {
   "label": "Website",
   "href": "https://playwright.dev"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "Apache-2.0",
   "status": "yes",
   "sub": "Use it in paid apps",
   "quote": "each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.",
   "note": "Apache-2.0 allows commercial use at no charge.",
   "src": "https://github.com/microsoft/playwright/blob/main/LICENSE"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Maintained",
   "status": "yes",
   "sub": "Last change Nov 24, 2026",
   "note": "Latest GitHub release Nov 13, 2026. ",
   "src": "https://github.com/microsoft/playwright"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "1,093 projects",
   "status": "info",
   "sub": "#2 of 122 in its category",
   "note": "Dependency in 1,093 public GitHub projects set up for AI coding agents that we scanned (17.5%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Official agent skills",
   "status": "yes",
   "sub": "4 from the makers",
   "note": "Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.",
   "src": null
  }
 ],
 "vfoot": "From the package registry and GitHub, checked daily; card checked Nov 11, 2026.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What Playwright (JavaScript) does",
   "parts": [
    {
     "t": "prose",
     "text": "Playwright Test is Microsoft's free tool for testing a website or web app the way a visitor uses it. Your tests open real Chrome, Firefox and Safari-engine browsers, click, type and check what appears on the page. It runs on Windows, Mac and Linux, on your computer or on a build server."
    },
    {
     "t": "h3",
     "text": "What people build with it"
    },
    {
     "t": "uses",
     "items": [
      {
       "title": "Check the sign-up form works",
       "text": "Before each release, a test fills in your sign-up form like a visitor and checks the thank-you message appears.",
       "idea": false
      },
      {
       "title": "Same test on three browsers",
       "text": "A layout bug that only shows in Safari or Firefox is caught before your visitors find it.",
       "idea": false
      },
      {
       "title": "Start the app before testing",
       "text": "The test run starts your local dev server itself, waits for it, and then opens the pages.",
       "idea": false
      },
      {
       "title": "Log in once for all tests",
       "text": "Tests behind a login do not each fill in the password form; they reuse a saved signed-in state.",
       "idea": false
      },
      {
       "title": "See why a test failed on CI",
       "text": "When a test fails on the build server, you open a recording with each step, the page and the network calls.",
       "idea": false
      },
      {
       "title": "Accessibility checks in the same run",
       "text": "Add an accessibility scan to key pages with the axe-core add-on, so missing labels fail the test run.",
       "idea": true
      }
     ]
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "Playwright (JavaScript) popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "94",
       "of": "/ 100",
       "l": "Gid Score, #4 overall"
      },
      {
       "n": "139M",
       "l": "downloads a week, npm"
      },
      {
       "n": "101K",
       "l": "GitHub stars"
      },
      {
       "n": "1,093",
       "l": "agent projects use it"
      }
     ]
    },
    {
     "t": "small",
     "text": "Gid Score measures public popularity and activity, not quality.",
     "link": "How the Gid Score is calculated",
     "path": "tools/top/"
    }
   ]
  },
  {
   "id": "usage",
   "nav": "How it is used",
   "h2": "How Playwright (JavaScript) is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "Playwright (JavaScript) is a dependency in 1,093 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (22.5% of the 4,867 JavaScript/TypeScript ones), #2 of 122 in testing.",
      "Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 2,160; those are left out of every share on this page.",
      "The most used alternative in our scan is Vitest (1,312 projects).",
      "Projects that use it most often also use Vitest (50.3%), TypeScript (76.9%), ESLint (58.3%).",
      "It is more common in projects set up for OpenCode (24.8%) than for Devin Desktop (14.7%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "699 projects, 21.3%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "547 projects, 18.0%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      },
      {
       "l": "398 projects, 16.3%",
       "v": "Cursor",
       "path": "agents/cursor/"
      },
      {
       "l": "109 projects, 23.2%",
       "v": "OpenAI Codex",
       "path": "agents/openai-codex/"
      },
      {
       "l": "106 projects, 22.4%",
       "v": "Gemini CLI",
       "path": "agents/gemini-cli/"
      },
      {
       "l": "85 projects, 24.8%",
       "v": "OpenCode",
       "path": "agents/opencode/"
      },
      {
       "l": "73 projects, 21.9%",
       "v": "OpenClaw",
       "path": "agents/openclaw/"
      },
      {
       "l": "41 projects, 14.7%",
       "v": "Devin Desktop",
       "path": "agents/devin-desktop/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 50.3% of its projects",
       "v": "Vitest",
       "path": "tools/vitest/"
      },
      {
       "l": "In 76.9% of its projects",
       "v": "TypeScript",
       "path": "tools/typescript/"
      },
      {
       "l": "In 58.3% of its projects",
       "v": "ESLint",
       "path": "tools/eslint/"
      },
      {
       "l": "In 30.5% of its projects",
       "v": "Testing Library",
       "path": "tools/testing-library/"
      },
      {
       "l": "In 41.2% of its projects",
       "v": "Vite",
       "path": "tools/vite/"
      },
      {
       "l": "In 52.2% of its projects",
       "v": "Tailwind CSS",
       "path": "tools/tailwindcss/"
      },
      {
       "l": "In 51.2% of its projects",
       "v": "React",
       "path": "tools/react/"
      },
      {
       "l": "In 27.9% of its projects",
       "v": "jsdom",
       "path": "tools/jsdom/"
      }
     ]
    }
   ]
  },
  {
   "id": "profile",
   "nav": "Profile",
   "h2": "Playwright (JavaScript) in practice",
   "parts": [
    {
     "t": "h3",
     "text": "Strengths"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Waiting is built into actions and assertions",
       "v": "The README says Playwright waits for elements to be actionable before it acts. Assertions retry until their condition is met, so tests don't need hand-written sleeps."
      },
      {
       "l": "A fresh browser profile per test, with login saved once",
       "v": "Each test runs in its own browser context. You can save the logged-in state to a file with <code>storageState</code> and load it in other tests with <code>test.use</code>."
      },
      {
       "l": "Trace Viewer records every step of a failed run",
       "v": "A trace holds DOM snapshots, network requests, console logs and screenshots for every action. The site says you can investigate a failure without running the test again."
      },
      {
       "l": "Agents act on element refs, not pixels",
       "v": "Through MCP, the model gets an accessibility snapshot in which each element has a ref such as <code>e5</code>. It passes that ref to the next tool call. The docs say no screenshots or coordinate guessing are needed."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Watch out for"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Browsers, not test code, set the speed limit",
       "v": "Endform, which sells a Playwright runner, writes that end-to-end suites are limited by the resources each browser consumes. Large suites end up sharded across machines."
      },
      {
       "l": "MCP costs more context and opens a visible browser",
       "v": "The docs' own comparison rates MCP's token cost as higher than the CLI's, because tool schemas and snapshots sit in context. MCP also runs headed by default, while the CLI runs headless."
      },
      {
       "l": "MCP exposes page-defined WebMCP tools unless you opt out",
       "v": "Since v1.64.0, Playwright MCP offers tools that a page registers through the experimental WebMCP API to the agent as <code>webmcp_&lt;tool&gt;</code>. Pass <code>--no-webmcp</code> to turn this off."
      }
     ]
    },
    {
     "t": "h3",
     "text": "A first test with role-based locators"
    },
    {
     "t": "tabs",
     "label": "Example",
     "items": [
      {
       "tab": "Typescript",
       "code": "import { test, expect } from '@playwright/test';\n\ntest('has title', async ({ page }) => {\n  await page.goto('https://playwright.dev/');\n  await expect(page).toHaveTitle(/Playwright/);\n});\n\ntest('get started link', async ({ page }) => {\n  await page.goto('https://playwright.dev/');\n  await page.getByRole('link', { name: 'Get started' }).click();\n  await expect(page.getByRole('heading', { name: 'Installation' })).toBeVisible();\n});"
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "profile",
   "h2": "More about Playwright (JavaScript)",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "Agent Skills for it",
       "path": "skills/",
       "items": [
        ": 18 Lessons to Get Started Building AI Agents",
        ": Skills, MCP servers, Custom Agents, Agents.md for SDKs to ground Coding Agents",
        ": A refined collection of Hypervelocity Engineering components (instructions, prompts, agents, and skills) to start your project off right, or",
        ": CLI for testing and evaluating AI agent workflows, custom agents, and skills with repeatable scenarios, graders, evidence, and CI integratio",
        "playwright-recording: Record browser interactions as video using Playwright. Use for capturing demo videos, app walkthroughs, and UI flows for Remotion videos. Tr",
        "playwright-interactive: Persistent browser and Electron interaction through `js_repl` for fast iterative UI debugging."
       ]
      },
      {
       "title": "Packages around it",
       "items": [
        "playwright: Library for browser automation scripts",
        "@playwright/mcp: MCP server for AI agents",
        "@playwright/cli: Browser CLI for coding agents",
        "@playwright/experimental-ct-react: Experimental React component testing",
        "@playwright/browser-chromium: Chromium browser download",
        "@playwright/browser-webkit: WebKit browser download"
       ]
      },
      {
       "title": "More in Testing",
       "path": "tools/testing/",
       "items": [
        {
         "text": "Testing Library",
         "path": "tools/testing-library/"
        },
        {
         "text": "jsdom",
         "path": "tools/jsdom/"
        },
        {
         "text": "pytest",
         "path": "tools/pytest/"
        },
        {
         "text": "Happy DOM",
         "path": "tools/happy-dom/"
        },
        {
         "text": "axe-core Playwright",
         "path": "tools/axe-core-playwright/"
        },
        {
         "text": "SuperTest",
         "path": "tools/supertest/"
        },
        {
         "text": "Mock Service Worker",
         "path": "tools/msw/"
        },
        {
         "text": "Faker.js",
         "path": "tools/faker-js-faker/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "Playwright (JavaScript)",
       "me": true,
       "facts": [
        "Apache-2.0",
        "Gid 94",
        "139M/wk"
       ]
      },
      {
       "name": "Cypress",
       "why": "Pick Cypress if your team prefers its end-to-end runner and its way of writing tests.",
       "path": "tools/cypress/",
       "facts": []
      },
      {
       "name": "Vitest",
       "why": "Pick Vitest for fast unit tests of functions and components; use Playwright for whole pages in a browser.",
       "path": "tools/vitest/",
       "facts": [
        "MIT",
        "Gid 86",
        "194M/wk"
       ]
      },
      {
       "name": "Playwright (Python)",
       "why": "Pick Playwright for Python when your tests or scripts are written in Python.",
       "path": "tools/playwright/",
       "facts": []
      },
      {
       "name": "Jest",
       "why": "Delightful JavaScript testing framework with minimal configuration.",
       "path": "tools/jest/",
       "facts": [
        "MIT",
        "Gid 86",
        "63.2M/wk"
       ]
      }
     ],
     "more": "Compare Playwright (JavaScript) with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "prompt",
     "text": "Add @playwright/test 1.65.0 as a dev dependency (Node 22+), run npx playwright install, write tests in tests/*.spec.ts with getByRole/getByLabel locators and await expect(...) assertions (no fixed waits), set webServer and baseURL in playwright.config.ts, and run npx playwright test."
    },
    {
     "t": "steps",
     "items": [
      {
       "text": "Add it to a project and download the browsers it needs.",
       "code": "npm i -D @playwright/test\nnpx playwright install\n",
       "src": "https://github.com/microsoft/playwright/blob/main/README.md"
      },
      {
       "text": "Write a test file in tests/ with test() and expect().",
       "code": "import { test, expect } from '@playwright/test';\n\ntest('has title', async ({ page }) => {\n  await page.goto('https://playwright.dev/');\n  await expect(page).toHaveTitle(/Playwright/);\n});\n",
       "src": "https://github.com/microsoft/playwright/blob/main/README.md"
      },
      {
       "text": "Run all tests; open the report when something fails.",
       "code": "npx playwright test\nnpx playwright show-report\n",
       "src": "https://playwright.dev/docs/intro"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Rules for your agent"
    },
    {
     "t": "rules",
     "label": "Paste into AGENTS.md or CLAUDE.md",
     "text": "## Playwright\n- Install with `npm i -D @playwright/test`, then run `npx playwright install` to download the browsers.\n- Locate elements the way users see them: `getByRole`, `getByLabel`, `getByPlaceholder`, `getByTestId`. Avoid CSS paths.\n- Do not add artificial timeouts. Use `await expect(...)` web-first assertions, which retry until the condition is met.\n- Save login state once with `page.context().storageState({ path: 'auth.json' })` and reuse it with `test.use({ storageState: 'auth.json' })`.\n- Set `trace: 'on-first-retry'` in `playwright.config.ts` and open failures with `npx playwright show-trace trace.zip`.\n- To drive a browser yourself, prefer `playwright-cli`: its output is concise and keeps tool schemas out of context. Act on the element refs from the latest snapshot.\n"
    },
    {
     "t": "h3",
     "text": "Mistakes to avoid"
    },
    {
     "t": "mistakes",
     "items": [
      {
       "dont": "await page.waitForTimeout(3000) before checking the page",
       "fix": "await expect(locator).toHaveText(...) and other web-first assertions",
       "why": "Assertions retry until the page is ready; fixed waits make tests slow and flaky."
      },
      {
       "dont": "npm i playwright @playwright/test  (both packages)",
       "fix": "npm i -D @playwright/test  only",
       "why": "npx playwright test stops working when both are installed."
      },
      {
       "dont": "Upgrading @playwright/test without downloading new browsers",
       "fix": "npm install -D @playwright/test@<version> && npx playwright install --with-deps",
       "why": "Every version needs its own browser builds; old ones do not match."
      },
      {
       "dont": "readonly submit = this.page.getByRole(...) as a class field in a page object (1.65+)",
       "fix": "Assign the locator inside the constructor, or set useDefineForClassFields to false in tsconfig.json",
       "why": "Since 1.65 class fields follow tsconfig like tsc, so the field runs before the constructor sets page."
      },
      {
       "dont": "page.accessibility.snapshot() for accessibility tests",
       "fix": "Use @axe-core/playwright, or locator.ariaSnapshot() for the accessibility tree",
       "why": "page.accessibility was removed after years of deprecation."
      }
     ]
    }
   ]
  },
  {
   "id": "faq",
   "nav": "Questions",
   "h2": "Questions",
   "parts": [
    {
     "t": "faq",
     "items": [
      {
       "q": "Do I need to add waits or sleeps?",
       "a": "No. Playwright waits for elements to be ready, and assertions retry until they pass or time out.",
       "evidence": {
        "url": "https://playwright.dev/docs/writing-tests",
        "quote": "You don't need to add manual waits or deal with race conditions."
       }
      },
      {
       "q": "Should I install playwright and @playwright/test together?",
       "a": "No. Install only @playwright/test; it also exports the browser automation functions.",
       "evidence": {
        "url": "https://playwright.dev/docs/release-notes",
        "quote": "There's no need to install both, since you can always import browser automation APIs from @playwright/test directly"
       }
      },
      {
       "q": "Can it check accessibility?",
       "a": "Not by itself any more; page.accessibility was removed and the docs point to Axe.",
       "evidence": {
        "url": "https://playwright.dev/docs/release-notes",
        "quote": "Please use other libraries such as Axe if you need to test page accessibility."
       }
      },
      {
       "q": "Can my company download the browsers from its own server?",
       "a": "Yes. Set PLAYWRIGHT_DOWNLOAD_HOST to an internal mirror before npx playwright install.",
       "evidence": {
        "url": "https://playwright.dev/docs/browsers",
        "quote": "Sometimes companies maintain an internal artifact repository to host browser binaries."
       }
      },
      {
       "q": "Does it run under Bun?",
       "a": "Since 1.65 the test runner can run under Bun with the --bun flag, with some features missing such as watch mode.",
       "evidence": {
        "url": "https://playwright.dev/docs/release-notes",
        "quote": "The test runner now runs under Bun ."
       }
      }
     ]
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "npm @playwright/test"
  ],
  [
   "Category",
   "Testing"
  ],
  [
   "License",
   "Apache-2.0"
  ],
  [
   "Latest version",
   "v1.64.0, October 7, 2026"
  ],
  [
   "On GitHub since",
   "November 2019"
  ],
  [
   "Gid Score",
   "93.5"
  ],
  [
   "Rank in category",
   "#2 of 122"
  ],
  [
   "GitHub",
   "microsoft/playwright"
  ],
  [
   "Last change",
   "Nov 24, 2026"
  ]
 ],
 "good": [
  "Each Playwright version needs its own browser builds, so download them again (playwright install) after every upgrade.",
  "The browsers take a few hundred megabytes of disk space and come from Microsoft's download servers.",
  "The docs ask for Node.js 22, 24 or 26 and macOS 14 or newer on a Mac."
 ],
 "checked_line": "Read by AgentGid from 9 official pages, card checked Nov 11, 2026; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/microsoft.png"
}