freshcrate
Home > Frameworks > pytest-playwright

pytest-playwright

A pytest wrapper with fixtures for Playwright to automate web browsers

Description

# Pytest plugin for Playwright [![PyPI](https://img.shields.io/pypi/v/pytest-playwright)](https://pypi.org/project/pytest-playwright/) Write end-to-end tests for your web apps with [Playwright](https://github.com/microsoft/playwright-python) and [pytest](https://docs.pytest.org/en/stable/). - Support for **all modern browsers** including Chromium, WebKit and Firefox. - Support for **headless and headed** execution. - **Built-in fixtures** that provide browser primitives to test functions. **Note**: If you are looking for an asyncio version of this plugin, check out [pytest-playwright-asyncio](https://pypi.org/project/pytest-playwright-asyncio/). ## Documentation See on [playwright.dev](https://playwright.dev/python/docs/test-runners) for examples and more detailed information.

Release History

VersionChangesUrgencyDate
0.7.2Imported from PyPI (0.7.2)Low4/21/2026
v0.7.2## What's Changed * chore(deps): bump django from 4.2.22 to 4.2.24 by @dependabot[bot] in https://github.com/microsoft/playwright-pytest/pull/292 * chore: drop Python 3.9 by @mxschmitt in https://github.com/microsoft/playwright-pytest/pull/299 * chore: support Pytest v9 by @mxschmitt in https://github.com/microsoft/playwright-pytest/pull/300 * fix: check common name for incompatible plugin by @JamesYFC in https://github.com/microsoft/playwright-pytest/pull/294 ## New Contributors * @JameLow11/20/2025
v0.7.1Bugfixes: * fix: use png screenshot type after Playwright v1.55.0 alignment by @mxschmitt in https://github.com/microsoft/playwright-pytest/pull/290 * feat: add async/sync compatibility check by @mecampbellsoup in https://github.com/microsoft/playwright-pytest/pull/282 ## New Contributors * @roberfi made their first contribution in https://github.com/microsoft/playwright-pytest/pull/285 * @mecampbellsoup made their first contribution in https://github.com/microsoft/playwright-pytest/pulLow9/8/2025
v0.7.0Allow declaring `connect_options` fixture to connect to remote browsers.Low1/31/2025
v0.6.2Bugfixes: - devops: publish wheels in https://github.com/microsoft/playwright-pytest/pull/261 Low11/26/2024
v0.6.1Fix conda publishingLow11/25/2024
v0.6.0## What's Changed * feat: pytest-playwright-asyncio as separate plugin in https://github.com/microsoft/playwright-pytest/pull/257 * feat: expose output_path fixture in https://github.com/microsoft/playwright-pytest/pull/248 * chore: drop Python 3.8 in https://github.com/microsoft/playwright-pytest/pull/253 **Full Changelog**: https://github.com/microsoft/playwright-pytest/compare/v0.5.2...v0.6.0Low11/25/2024
v0.5.2Bugfixes: * chore: add py.typed file in https://github.com/microsoft/playwright-pytest/pull/245 * chore: hide internal methods in https://github.com/microsoft/playwright-pytest/pull/236 * Update conda dependencies to match setup.py in https://github.com/microsoft/playwright-pytest/pull/242 * Fix conda build and publish workflow in https://github.com/microsoft/playwright-pytest/pull/243 **Full Changelog**: https://github.com/microsoft/playwright-pytest/compare/v0.5.1...v0.5.2Low9/6/2024
v0.5.1Bugfixes * fix: catch PermissionError when cleaning the tests results with multiple threads (#224) in https://github.com/microsoft/playwright-pytest/pull/230 Low7/3/2024
v0.5.0Bugfixes: * fix: improve video naming in https://github.com/microsoft/playwright-pytest/pull/217 * feat: support artifact collection with multiple contexts in https://github.com/microsoft/playwright-pytest/pull/216 * fix: clean up videos after each test in https://github.com/microsoft/playwright-pytest/pull/221 * fix: migrate artifacts_folder to session fixture in https://github.com/microsoft/playwright-pytest/pull/223 **Full Changelog**: https://github.com/microsoft/playwright-pytest/cLow5/6/2024
v0.4.4Bugfixes: * fix: use best-effort artifacts folder removal in https://github.com/microsoft/playwright-pytest/pull/191 * chore: support Pytest v8 in https://github.com/microsoft/playwright-pytest/pull/203 Low2/2/2024
v0.4.3Bugfixes: * fix: mark.browser_context_args should clear for the next test in https://github.com/microsoft/playwright-pytest/pull/189 **Full Changelog**: https://github.com/microsoft/playwright-pytest/compare/v0.4.2...v0.4.3Low10/9/2023
v0.4.2Fix conda publishingLow8/9/2023
v0.4.1Fix conda publishingLow8/7/2023
v0.4.0## What's Changed * Full Page Screenshots by @CGBassPlayer in https://github.com/microsoft/playwright-pytest/pull/148 * Allow user to overwrite `browser_context_args` using a marker by @aklajnert in https://github.com/microsoft/playwright-pytest/pull/146 * Adding conda recipe by @owenlamont in https://github.com/microsoft/playwright-pytest/pull/176 **Full Changelog**: https://github.com/microsoft/playwright-pytest/compare/v0.3.3...v0.4.0Low8/7/2023
v0.3.3## What's Changed * fix: have correct trace title by @mxschmitt in https://github.com/microsoft/playwright-pytest/pull/157 * Update to allow the latest `python-slugify` by @jensenbox in https://github.com/microsoft/playwright-pytest/pull/160 * fix: support long test names by @mxschmitt in https://github.com/microsoft/playwright-pytest/pull/165 ## New Contributors * @jensenbox made their first contribution in https://github.com/microsoft/playwright-pytest/pull/160 **Full Changelog**Low4/24/2023
v0.3.2## What's Changed * fix: respect manual base_url fixture override in https://github.com/microsoft/playwright-pytest/pull/154 Low3/10/2023
v0.3.1### Bugfixes - [BUG] Implement best-effort support when dealing with busy folders. https://github.com/microsoft/playwright-python/issues/1781Low2/28/2023
v0.3.0## What's Changed * chore: enable sources for trace collection by @mxschmitt in https://github.com/microsoft/playwright-pytest/pull/104 * remove unused event_loop session-scoped fixture by @skarzi in https://github.com/microsoft/playwright-pytest/pull/106 * chore: launch the browser headed by default if the vscode debugger is attached by @mxschmitt in https://github.com/microsoft/playwright-pytest/pull/107 ## New Contributors * @skarzi made their first contribution in https://github.comLow3/16/2022
v0.2.3## What's Changed * fix: Ignore FileNotFoundError when cleaning up output_dir by @shadowwolf899 in https://github.com/microsoft/playwright-pytest/pull/97 * fix: Added check for if rep_call is missing by @shadowwolf899 in https://github.com/microsoft/playwright-pytest/pull/96 ## New Contributors * @shadowwolf899 made their first contribution in https://github.com/microsoft/playwright-pytest/pull/97 **Full Changelog**: https://github.com/microsoft/playwright-pytest/compare/v0.2.2...v0.2Low2/10/2022
v0.2.2## What's Changed ### Fixes * chore: change browser_context_args back to session fixture by @mxschmitt in https://github.com/microsoft/playwright-pytest/pull/85 (fixes https://github.com/microsoft/playwright-pytest/issues/73) * test: add test for launching persistent context with session scope by @mxschmitt in https://github.com/microsoft/playwright-pytest/pull/86 **Full Changelog**: https://github.com/microsoft/playwright-pytest/compare/v0.2.1...v0.2.2Low10/28/2021
v0.2.1## What's Changed * fix: tempfile handling when recording videos by @mxschmitt in https://github.com/microsoft/playwright-pytest/pull/83 (Fixes #81) **Full Changelog**: https://github.com/microsoft/playwright-pytest/compare/v0.2.0...v0.2.1Low10/11/2021
v0.2.0## Features - feat: add more testing goodies (screenshot, video, tracing) (#70) - feat: device emulation via CLI parameter (#61) ## Breaking - browser_context_args fixture scope has changed from `session` to `function` Low8/16/2021
v0.1.2Changes: - fix: make it compatible with `unittest.TestCase` and pytest-bdd (#56)Low6/7/2021
v0.1.1Enhanced support for usage with launch_persistent_context (#51)Low5/19/2021
v0.1.0- chore: replace headful with headed option (#48) - feat: added browser channel argument (#47) - feat: added slowmo option (#45)Low4/1/2021
v0.0.12Supports now Playwright >= 1.9.0Low2/25/2021
v0.0.11Update to use Playwright 1.8.0a1Low1/21/2021
v0.0.10Bugfixes: - fix(screenshot): handle if there is no Page fixture available (#30) - fix: compatible with Playwright 0.170.0 (#32)Low12/16/2020
v0.0.9Bugfixes: - fix: don't paramaterize test functions that don't use browser fixtures (#28) Chore: - fix(django): configure DJANGO_SETTINGS_MODULE in conftest.py (88a4079) - fix(pre-commit): fix mypy error (727a5f7) - lint: follow up to the last commit (858a9b4) Low11/24/2020
v0.0.8Bugfixes: - fix: device emulation (#22) Documentation: - docs(readme): add config for pytest.ini (#13) - docs: add examples for custom fixtures (#16) Chore: - chore: test and add support for Python 3.9 (#17)Low11/10/2020
v0.0.7Bugfixes: - fix(django): usage with class based tests (#12) Docs: - docs(readme): update structure (#9)Low10/3/2020
v0.0.6**BREAKING**: - chore(typo): fix browse to browser (#8) Documentation: - docs: fix screenshot section (#7) - docs: add guide about debugging Playwright Python (#5)Low9/29/2020
v0.0.5Changes: - feat: migrated project over to Microsoft namespace (#1) - fix: use greater than as Playwright requirement(#3) - fix: report not valid browser names as error (#4) **BREAKING**: - enh: renamed fixtures for better readability (#2) Low8/5/2020

Dependencies & License Audit

Loading dependencies...

Similar Packages

pre-commitA framework for managing and maintaining multi-language pre-commit hooks.v4.6.0
azure-core-tracing-opentelemetryMicrosoft Azure Azure Core OpenTelemetry plugin Library for Pythonazure-template_0.1.0b6187637
spdx-toolsSPDX parser and tools.0.8.5
lacesDjango components that know how to render themselves.0.1.2
django-tasksA backport of Django's built in Tasks framework0.12.0