Skip to main content
Ask AI

Get Started with Playwright (Python)

Getting started takes four steps: install the packages, install the browsers, write a test, and run pytest. The plugin auto-registers through a pytest11 entry point, so there is no conftest.py wiring to add.

Paste this prompt into your coding agent:

Setup prompt
Add TestRelic analytics to this Playwright Python project.
1. Install the packages: pip install pytest-playwright testrelic-playwright
2. Install the browsers: playwright install
3. Add a simple Playwright test under tests/ that uses the `page` fixture.
4. Do NOT add any conftest.py wiring or imports — the plugin auto-registers
via its pytest11 entry point.
5. Run `pytest` and open test-results/analytics-timeline.html to confirm the
report was generated.

Full quickstart

Terminal
pip install pytest-playwright testrelic-playwright
playwright install
pytest
note

There is nothing to import and no conftest.py to edit. As long as testrelic-playwright is installed in the same environment as pytest, the plugin is active automatically.

Output files

A run writes the analytics timeline into test-results/:

test-results/
├── analytics-timeline.json
└── analytics-timeline.html

Open analytics-timeline.html in any browser for the interactive report. Outside of CI the report opens automatically when the run finishes.

Requirements

RequirementVersion
Python>=3.9
pytest>=7.0
pytest-playwright>=0.5.0
playwright>=1.35
httpx>=0.27

Next steps