{
 "kind": "tool",
 "slug": "playwright",
 "path": "tools/playwright/",
 "name": "Playwright (Python)",
 "maker": null,
 "density": "profile",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "Scraping, browsers and parsing",
   "tools/scraping-parsing/"
  ]
 ],
 "lead": "High-level Python API for automating browser testing and web scraping.",
 "chips": [
  {
   "label": "Scraping, browsers and parsing",
   "path": "tools/scraping-parsing/"
  },
  {
   "label": "PYPI"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "pip install playwright"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/microsoft/playwright-python"
  },
  {
   "label": "Website",
   "href": "https://github.com/Microsoft/playwright-python"
  }
 ],
 "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": null,
   "note": "License from PyPI license expression.",
   "src": "https://github.com/microsoft/playwright-python"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Maintained",
   "status": "yes",
   "sub": "Last change Nov 23, 2026",
   "note": "Latest GitHub release Nov 14, 2026. ",
   "src": "https://github.com/microsoft/playwright-python"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "76 projects",
   "status": "info",
   "sub": "#5 of 141 in its category",
   "note": "Dependency in 76 public GitHub projects set up for AI coding agents that we scanned (1.2%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Official agent skills",
   "status": "yes",
   "sub": "3 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.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What Playwright (Python) does",
   "parts": [
    {
     "t": "prose",
     "text": "One Python library drives Chromium, Firefox and WebKit through matching sync and async APIs, and the wider Playwright project now also offers an MCP server and a CLI that give AI agents accessibility snapshots instead of screenshots."
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "Playwright (Python) popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "77",
       "of": "/ 100",
       "l": "Gid Score, #153 overall"
      },
      {
       "n": "34.7M",
       "l": "downloads a week, pypi"
      },
      {
       "n": "15.1K",
       "l": "GitHub stars"
      },
      {
       "n": "76",
       "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 (Python) is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "Playwright (Python) is a dependency in 76 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (4.7% of the 1,623 Python ones), #5 of 141 in scraping, browsers and parsing.",
      "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 814; those are left out of every share on this page.",
      "The most used alternative in our scan is Selenium (27 projects).",
      "Projects that use it most often also use python-dotenv (64.5%), Uvicorn (52.6%), Pillow (44.7%).",
      "It is more common in projects set up for OpenClaw (4.8%) than for GitHub Copilot (0.8%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "42 projects, 1.3%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "26 projects, 1.1%",
       "v": "Cursor",
       "path": "agents/cursor/"
      },
      {
       "l": "24 projects, 0.8%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      },
      {
       "l": "16 projects, 4.8%",
       "v": "OpenClaw",
       "path": "agents/openclaw/"
      },
      {
       "l": "7 projects, 1.5%",
       "v": "Gemini CLI",
       "path": "agents/gemini-cli/"
      },
      {
       "l": "5 projects, 1.5%",
       "v": "OpenCode",
       "path": "agents/opencode/"
      },
      {
       "l": "5 projects, 1.8%",
       "v": "Devin Desktop",
       "path": "agents/devin-desktop/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 64.5% of its projects",
       "v": "python-dotenv",
       "path": "tools/python-dotenv/"
      },
      {
       "l": "In 52.6% of its projects",
       "v": "Uvicorn",
       "path": "tools/uvicorn/"
      },
      {
       "l": "In 44.7% of its projects",
       "v": "Pillow",
       "path": "tools/pillow/"
      },
      {
       "l": "In 43.4% of its projects",
       "v": "Pydantic",
       "path": "tools/pydantic/"
      },
      {
       "l": "In 40.8% of its projects",
       "v": "FastAPI",
       "path": "tools/fastapi/"
      },
      {
       "l": "In 39.5% of its projects",
       "v": "Requests",
       "path": "tools/requests-py/"
      },
      {
       "l": "In 38.2% of its projects",
       "v": "PyYAML",
       "path": "tools/pyyaml/"
      },
      {
       "l": "In 35.5% of its projects",
       "v": "Beautiful Soup",
       "path": "tools/beautifulsoup4/"
      }
     ]
    }
   ]
  },
  {
   "id": "profile",
   "nav": "Profile",
   "h2": "Playwright (Python) in practice",
   "parts": [
    {
     "t": "h3",
     "text": "Strengths"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "One loop over three engines",
       "v": "The README example calls <code>launch()</code>, <code>new_page()</code>, <code>goto()</code> and <code>screenshot()</code> inside a loop over Chromium, Firefox and WebKit. It saves one screenshot per engine, named with <code>browser_type.name</code>."
      },
      {
       "l": "Blocking and asyncio versions of the same script",
       "v": "The README shows the example twice. The second version uses <code>async_playwright()</code>, awaits each browser call and runs under <code>asyncio.run(main())</code>."
      },
      {
       "l": "Auto-waiting, by the maintainers' account",
       "v": "The site says actions wait until elements are actionable and that assertions retry until their conditions are met. The maintainers sum this up as \"No artificial timeouts, no flaky tests.\""
      },
      {
       "l": "Trace Viewer for failed runs",
       "v": "The site describes the Trace Viewer as a full timeline of a test run. It shows DOM snapshots, network requests, console logs and screenshots \"at every step\", so you can investigate failures without re-running."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Watch out for"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Front page shows npm commands and camelCase names",
       "v": "The Python site's front page gives install commands such as <code>npm init playwright@latest</code> and <code>npm i -g @playwright/cli@latest</code>. It names locators <code>getByRole</code> and <code>getByLabel</code>, while the Python release notes write <code>get_by_role</code>."
      },
      {
       "l": "Ubuntu 20.04 no longer supported",
       "v": "The v1.63.0 release notes announce that Ubuntu 20.04 is not supported anymore."
      },
      {
       "l": "Frame locators without a selector can throw",
       "v": "<code>frame_locator()</code> called with no selector searches every frame in the subtree. The rest of the locator then resolves inside a single frame, and the release notes say \"an error is thrown when it matches elements in several frames.\""
      }
     ]
    },
    {
     "t": "h3",
     "text": "Screenshot a page in all three engines"
    },
    {
     "t": "tabs",
     "label": "Example",
     "items": [
      {
       "tab": "Python",
       "code": "from playwright.sync_api import sync_playwright\n\nwith sync_playwright() as p:\n    for browser_type in [p.chromium, p.firefox, p.webkit]:\n        browser = browser_type.launch()\n        page = browser.new_page()\n        page.goto('http://playwright.dev')\n        page.screenshot(path=f'example-{browser_type.name}.png')\n        browser.close()"
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "profile",
   "h2": "More about Playwright (Python)",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "Agent Skills for it",
       "path": "skills/",
       "items": [
        ": 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 common Playwright actions. Record and generate Playwright code, inspect selectors and take screenshots.",
        "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.",
        "playwright-expert: Use when writing E2E tests with Playwright, setting up test infrastructure, or debugging flaky browser tests. Invoke to write test scripts,"
       ]
      },
      {
       "title": "Packages around it",
       "items": [
        "python-dotenv: Env vars from .env",
        "pydantic: Data validation",
        "requests: HTTP client",
        "uvicorn: ASGI server",
        "pillow: Image processing",
        "fastapi: Web API framework"
       ]
      },
      {
       "title": "More in Scraping, browsers and parsing",
       "path": "tools/scraping-parsing/",
       "items": [
        {
         "text": "Beautiful Soup",
         "path": "tools/beautifulsoup4/"
        },
        {
         "text": "Puppeteer",
         "path": "tools/puppeteer/"
        },
        {
         "text": "Playwright Core",
         "path": "tools/playwright-core/"
        },
        {
         "text": "lxml",
         "path": "tools/lxml/"
        },
        {
         "text": "Cheerio",
         "path": "tools/cheerio/"
        },
        {
         "text": "fast-xml-parser",
         "path": "tools/fast-xml-parser/"
        },
        {
         "text": "jsonc-parser",
         "path": "tools/jsonc-parser/"
        },
        {
         "text": "Mozilla Readability",
         "path": "tools/mozilla-readability/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "Playwright (Python)",
       "me": true,
       "facts": [
        "Apache-2.0",
        "Gid 77",
        "34.7M/wk"
       ]
      },
      {
       "name": "Selenium",
       "why": "Official Python bindings for browser automation and web scraping.",
       "path": "tools/selenium/",
       "facts": [
        "Apache-2.0",
        "Gid 61",
        "6.5M/wk"
       ]
      }
     ],
     "more": "Compare Playwright (Python) with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "install",
     "intro": "Install it.",
     "code": "pip install playwright"
    },
    {
     "t": "h3",
     "text": "Rules for your agent"
    },
    {
     "t": "rules",
     "label": "Paste into AGENTS.md or CLAUDE.md",
     "text": "## Playwright (Python)\n- For blocking code, follow the README: `from playwright.sync_api import sync_playwright` and `with sync_playwright() as p:`. For asyncio, use `async with async_playwright() as p:` and `await` the browser calls (`launch()`, `new_page()`, `goto()`, `screenshot()`, `close()`), run via `asyncio.run(main())`.\n- Take Python syntax from the Python docs (https://playwright.dev/python/docs/intro) and API reference (https://playwright.dev/python/docs/api/class-playwright), e.g. `page.frame_locator().get_by_role(\"button\").click()`. Do not copy the `getByRole`-style names or npm commands shown on the landing page.\n- To filter to visible elements, use `locator.visible` (e.g. `page.locator(\"button\").visible.click()`). The release notes call it the recommended replacement for the `:visible` CSS pseudo-class.\n- To reach an element in an iframe without locating the iframe first, call `page.frame_locator()` with no selector. Make the rest of the locator specific enough to match in only one frame, or it throws.\n- To record an aria snapshot and a screenshot on every action, start tracing with `context.tracing.start(snapshots=True, aria_snapshots=True, screen_snapshots=True)`.\n- `http_credentials` accepts an array. The first entry matching the request origin is used, and an entry without an origin matches any request. Use `playwright codegen --http-credentials` to record against pages behind HTTP authentication.\n"
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "pypi playwright"
  ],
  [
   "Category",
   "Scraping, browsers and parsing"
  ],
  [
   "License",
   "Apache-2.0"
  ],
  [
   "Latest version",
   "v1.63.0, September 15, 2026"
  ],
  [
   "On GitHub since",
   "July 2020"
  ],
  [
   "Gid Score",
   "77.2"
  ],
  [
   "Rank in category",
   "#5 of 141"
  ],
  [
   "GitHub",
   "microsoft/playwright-python"
  ],
  [
   "Last change",
   "Nov 23, 2026"
  ]
 ],
 "good": [],
 "checked_line": "From the package registry, GitHub and our scan of public agent projects; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/microsoft.png"
}