example.py opens https://the-internet.herokuapp.com headless with Playwright for Python and tracks the full page and the heading element with the Playwright integration of sdk-python, with an ignore area, a diff tolerance and agent details.
- Python 3.15 or later
- A running Visual Regression Tracker 6.0 server and its API key
- Copy
vrt.json.exampletovrt.jsonand set your connection, or use theVRT_*environment variables, which override the file - Install dependencies:
pip install -r requirements.txt - Install the browser:
playwright install chromium
python example.pyenableSoftAssert is on: the SDK logs a failed check instead of raising, so the script finishes and prints a link to each test run.
- First run:
No baselinefor "Home page" and "Heading". The VRT UI shows a build with two new test runs. Approve them to make them the baseline for the branch. - Next runs: nothing is logged while the page looks the same. When it changes,
Difference found, and the build shows the diff to approve or reject.
Set enableSoftAssert to false to make new and changed screenshots raise an error.