A Python interface to the very handy Playwright browser automation library. The 1.9.x releases feel more Pythonic. Naming conventions, stuff like that. Feels much less like just a wrapper.

Don’t forget to install browser drivers whenever you install or upgrade Playwright!

$ python -m playwright install

With pytest

The pytest-playwright plugin provides fixtures, marks, and extra pytest args for browser testing. So far the only fixture I’ve used is page, the standin for a default browser session. Pairs nicely with pytest-django’s live_server fixture.

Headless by default, but use pytest --headful if you want to watch the browser do its thing.

Note

Since pytest-playwright is still in early days – 0.0.12 as of this bookmark date – dependency managers might not acknowledge new releases. Watch the repo and manually update your dependencies when you see a new release.