Playwright

96.6k GitHub starsmicrosoft/playwright

Lets your code open a real browser and click, type and read pages like a person. Used to test websites, collect data and give AI assistants a browser.

View on GitHub

Build a stack with Playwright

Pick parts from it and the projects that work well with it. We check the licences together and write a prompt for your AI.

Playwright
Crawl4AI
Crawlee
Scrapy

Your stack

Tick the parts you want to use. Projects whose parts are not listed yet can be added whole; the prompt tells your AI to find the right pieces in their code.

Website (opens in a new tab)
More actions

Why we picked it

Playwright has become the standard way to let a program use a web browser. It's made by Microsoft, works with the engines behind Chrome, Firefox and Safari, and waits for pages to be ready by itself, so things break far less often. It's now the most popular choice for automatically testing websites, and it's also the browser inside many crawlers and AI assistants, including Crawl4AI and Crawlee. It gets new releases about once a month, the guides are excellent, and it's free to use in any project.

About Playwright

Playwright lets a program use a web browser the way a person does. It opens a page, clicks buttons, fills in forms, waits for things to load and reads what's on the screen. People use it for three main jobs: checking that their website still works after every change, collecting information from sites that only show their content in a browser, and letting AI assistants browse the web. It's made by Microsoft and works with JavaScript, TypeScript, Python, Java and .NET.

What it can do

  • One tool for every major browser. It works with the engines behind Chrome and Edge, Firefox and Safari, on Windows, Mac and Linux, either in a window you can watch or quietly in the background.
  • Waits for the page, so you don't have to. Before it clicks or types, it checks that the button or box is really there and ready. This removes most of the random failures that make browser tests so frustrating.
  • Writes the first draft for you. Its recorder watches you click through your site and turns what you did into a script you can replay.
  • Shows you exactly what went wrong. When something fails, you can replay it step by step, with screenshots, the page as it looked at that moment and everything it loaded.
  • Runs lots of checks at once. Each test gets its own clean browser session and they run side by side, so even a big set of tests finishes quickly.
  • Gives AI assistants a browser. Microsoft's Playwright MCP lets assistants such as Claude, ChatGPT's Codex and GitHub Copilot open websites and use them. It describes the page to the AI as a tidy outline instead of screenshots, which is quicker and cheaper. There are also built-in AI helpers that plan, write and repair tests.

Where you'll meet it

Plenty of other tools use Playwright behind the scenes. Crawl4AI and Crawlee use it to open pages that need a real browser, and Scrapy can use it through an add-on called scrapy-playwright. So even if you never write Playwright code yourself, it may well be doing the browsing for you.

Playwright, Selenium or Cypress?

These are the three best-known free tools for testing websites in a real browser. They overlap a lot, but each suits a different kind of team.

PlaywrightThis page

Best forTesting and automating modern websites

Fast, waits for pages on its own and runs many tests at once. Also the usual choice for collecting data and giving AI a browser. The default pick for new projects.

Language
JavaScript, TypeScript, Python, Java or .NET
Opens a browser
Chrome, Edge, Firefox and Safari's engine
Selenium

Best forBig existing test suites and more languages

The oldest and most widely supported option, with the widest choice of languages. It's slower, and you have to tell it when to wait, so tests break more often. Makes sense if you already have lots of Selenium tests.

Language
Java, Python, C#, Ruby, JavaScript and more
Opens a browser
Chrome, Edge, Firefox and Safari
Cypress

Best forFront-end teams that only write JavaScript

Very friendly for testing one web app you're building, with a great step-by-step debugger. JavaScript only, and made for testing rather than collecting data or automating other sites.

Language
JavaScript or TypeScript
Opens a browser
Chrome, Edge and Firefox (Safari is experimental)

A quick way to choose: starting something new? Use Playwright. Already have a large Selenium setup that works? Keep it, and write new tests in Playwright if you like. A small JavaScript team testing its own app, who love Cypress's debugger? Cypress is still a fine choice. For collecting data or giving an AI a browser, Playwright is the clear winner of the three.

Good to know

  • It's a toolkit for programmers, not an app. You'll write some code, though the recorder gives you a head start.
  • It downloads its own copies of the browsers, which take a few hundred megabytes. On Linux servers it also needs a few extra system files, which one command installs.
  • A real browser uses far more memory than simply downloading a page. For big crawls, read simple pages directly and open a browser only where it's needed. Crawlee does this for you.
  • Some websites can tell they're being visited by an automated browser and will block it. Follow each site's rules (its robots.txt file) and terms of use, and don't use it to get around protections.
  • It can act like a phone's web browser, but it can't test apps installed from the App Store or Google Play.
  • Licence: Apache 2.0. You can use it for free, including in paid products.

What you can build with it

  • Checking your website still works after every change, in every major browser
  • Collecting information from sites that only load their content in a browser
  • Letting an AI assistant open websites, click around and read pages
  • Automating boring browser chores, like filling in the same forms every week
  • Saving screenshots or PDFs of web pages

Building blocks

Playwright is made of parts you can use on their own in your project. Copy a prompt to have your AI assistant add one for you, and see the licence card for what you may do with them.

  • Control a browser from JavaScript

    Free to use, even in closed products

    The main Playwright package for JavaScript and TypeScript. Your code opens a browser, visits pages, clicks and types, and reads back what's there.

    Use it to build

    • Collecting data from pages that need a browser
    • Automating chores in web apps
    • Screenshots and PDFs of web pages
    View code
    Technical details
    Name
    playwright
    What it is
    Code library
    How to use it
    Install it and use it
    Install
    npm i playwright
    Licence
    Apache 2.0 (read from LICENSE)
  • Automatic website testing

    Free to use, even in closed products

    Playwright's testing tool. Write checks that click through your site like a visitor, run them in every browser at once, and replay step by step anything that fails.

    Use it to build

    • Checking a web app still works before each release
    • Testing in several browsers automatically
    View code
    Technical details
    Name
    @playwright/test
    What it is
    Command-line tool
    How to use it
    Install it and use it
    Install
    npm init playwright@latest
    Licence
    Apache 2.0 (read from LICENSE)
  • Control a browser from Python

    Free to use, even in closed products

    The official Python version of Playwright. It does the same job as the JavaScript one, including waiting for pages to be ready by itself.

    Use it to build

    • Python data-collection scripts
    • Python test suites
    • Data pipelines that need a real browser
    View code
    Technical details
    Name
    playwright (Python)
    What it is
    Code library
    How to use it
    Install it and use it
    Install
    pip install playwright && playwright install
    Licence
    Apache 2.0 (read from microsoft/playwright-python/LICENSE)

Works well with

  • Crawl4AI

    84.2k GitHub stars

    Reads websites for you and turns them into clean text or tidy data your AI can use, even pages that only load in a browser.

    • Web scraping & crawling
    • RAG & agents
    • Apache 2.0 with attribution clause
  • Crawlee

    25.9k GitHub stars

    Build web crawlers that keep going when things go wrong. Reads simple pages quickly and opens a real browser only when a page needs one.

    • Web scraping & crawling
    • RAG & agents
    • Apache 2.0
  • Scrapy

    64.5k GitHub stars

    A fast, long-trusted Python tool for collecting information from large websites and saving it as tidy data you can use.

    • Web scraping & crawling
    • Command line tools
    • BSD 3-Clause

Comments

No comments yet. Be the first to share your thoughts.