example.py opens https://the-internet.herokuapp.com in headless Chrome with Selenium and tracks two screenshots with sdk-python, the second with browser, viewport and device details.
- Python 3.11 or later
- Google Chrome; Selenium Manager downloads a matching chromedriver
- 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
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 "Checkboxes page". 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 pages look the same. When one 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.