skillfed

pytest-playwright

A pytest wrapper with fixtures for Playwright to automate web browsers

pytest-playwright v0.9.0 9.6M downloads/30d#1,516 on PyPI556
Permissive license Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for… (full text in the JSON record) Active released

What it is and what it does

pytest-playwright is a pytest plugin that wraps the Playwright browser automation library, exposing browser primitives as pytest fixtures so you can write end-to-end tests directly in your test functions. Instead of manually instantiating and managing browser contexts, you declare a `page` fixture (or `browser`, `context` fixtures) in your test signature and pytest-playwright handles the setup and teardown. It supports all modern browsers—Chromium, WebKit, and Firefox—and can run tests in headless or headed mode.

The plugin is maintained by Microsoft (Playwright's creator) and sits at the intersection of pytest's test discovery and fixture system with Playwright's cross-browser automation API. It's designed for teams writing web application tests that need to verify behavior across multiple browsers without writing boilerplate context management code. The package has no known vulnerabilities and is actively developed, with a recent release and steady repository maintenance.

Use it for:

  • Write end-to-end tests for web applications that verify user workflows across Chromium, Firefox, and WebKit without manual browser setup.
  • Run headless browser tests in CI/CD pipelines to validate web app functionality on every commit.
  • Test responsive design and cross-browser compatibility by parameterizing tests to run against multiple browser contexts.
  • Automate visual regression testing or screenshot capture as part of pytest test suites.
  • Verify form submissions, navigation, and DOM interactions in web apps using Playwright's page API within pytest test functions.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

A pytest plugin that integrates Playwright browser automation into pytest test functions via built-in fixtures, enabling end-to-end testing across Chromium, WebKit, and Firefox in headless or headed mode.

Yes. This is a well-maintained, actively developed plugin from Microsoft with no known vulnerabilities, low install friction, and a permissive license. It fills a clear need for teams using pytest who want to write end-to-end browser tests without boilerplate. The only gotcha is that Playwright requires browser binaries to be installed separately, but that is a one-time setup step and is well-documented.

Install

pytest-playwright on PyPI

pip

pip install pytest-playwright

uv

uv add pytest-playwright

poetry

poetry add pytest-playwright

Installing pytest-playwright

Before you install

Low friction install with a pure-Python wheel. Actively maintained with a recent release (4 days old) and steady repository activity. Requires Python 3.10 or later and depends on playwright, pytest, pytest-base-url, and python-slugify—all standard testing and utility packages.

License in practice

Licensed under Apache License 2.0 (permissive). You can use, modify, and distribute the package freely in commercial and private projects, provided you include a copy of the license and note any changes you make.

Quickstart

pip install pytest-playwright

# In a test file:
import pytest

def test_example(page):
    page.goto("https://example.com")
    assert page.title() == "Example Domain"

Requires Python 3.10 or later. Playwright also requires browser binaries; use `playwright install` after installing the package to download them.

Verify before relying

  • Whether pytest-base-url and python-slugify are required at runtime or only for specific test scenarios.
  • Whether the plugin automatically handles browser binary installation or if manual setup is needed in CI/CD environments.

Package facts

License Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for… (full text in the JSON record) (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 4 — playwright, pytest, pytest-base-url, python-slugify
Maintenance actively maintained — 4 days since the last release
Last repo commit
First released
Downloads 9,625,460/month — #1,516 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pytest_playwright-0.9.0-py3-none-any.whl

Framework :: PytestLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13

Tags

pytest playwright integrationend-to-end web testingbrowser automation testingpytest browser fixturescross-browser e2e testsplaywright pytest pluginweb app testing framework
e2e-testingbrowser-automationpytest-plugin

More Testing packages