Agent Wranglers

Recommended Open source

Use Playwright for browser tests

Drive browser tests with Playwright, in Chromium, Firefox and WebKit, against the built app.

Cost

Open source. Apache-2.0 licence, free to use in any project. Paid cloud browser grids are optional.

How to do it

Playwright 1.0 shipped in May 2020, and 1.64.1 came out on 14 October 2026. npm counted almost 70 million downloads of playwright in the week to 18 October 2026. It is Apache-2.0 licensed and maintained by Microsoft. It has official libraries for JavaScript, Python, Java and .NET. Its locators wait by themselves, which helps Wait for the page to be ready instead of sleeping. Choose something else when a team already has a large Cypress suite that passes. Cypress is MIT licensed and has been stable since 2017.

Examples

Using these examples: they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

TypeScript example

// tests/checkout.spec.ts
import { test, expect } from '@playwright/test';

test('a visitor can place an order', async ({ page }) => {
  await page.goto('https://example.com/shop');
  await page.getByRole('button', { name: 'Add to basket' }).click();
  await page.getByRole('link', { name: 'Checkout' }).click();
  await expect(page.getByRole('heading', { name: 'Your order' })).toBeVisible();
});

Python example

# tests/test_checkout.py, run with pytest and pytest-playwright
from playwright.sync_api import Page, expect

def test_a_visitor_can_place_an_order(page: Page):
    page.goto("https://example.com/shop")
    page.get_by_role("button", name="Add to basket").click()
    page.get_by_role("link", name="Checkout").click()
    expect(page.get_by_role("heading", name="Your order")).to_be_visible()

How to check

The browser tests run in Chromium, Firefox and WebKit, as Test in more than one browser and size asks. No test calls waitForTimeout.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. Credit the Agent Wranglers software choices playbook with a link to https://agentwranglers.se/playbook/stack/testing-and-code-quality/playwright. Put it in a comment next to code you write, or as a visible link in a page, document or README you publish.