Skip to main content

selenium-screenshot-compare

Compare a website's rendering between two Firefox versions through a click-based navigation scenario. At each step, both full-page renders are captured and their pixel difference is measured.

Usable from plain Python or as a Robot Framework library.

Installation

uv add selenium-screenshot-compare
# or pip install selenium-screenshot-compare

You need two Firefox binaries (your system Firefox + a second version). See docs/firefox-setup.md for how to get one.

Quick start — Python

from selenium_screenshot_compare import DualSession, compare_images

session = DualSession("/usr/bin/firefox", "./firefoxes/firefox-128esr/firefox")
session.open("https://example.com")
session.click("css=a.nav-link")
session.capture_both("a.png", "b.png")
result = compare_images("a.png", "b.png", "diff.png")
print(f"{result.percent:.2f} % difference")
session.close()

Quick start — Robot Framework

uv add selenium-screenshot-compare[robot]
# or: pip install selenium-screenshot-compare[robot]
robot --outputdir output/robot tests/interactive_navigation.robot
Open Versions    ${SITE}    ${FIREFOX_A}    ${FIREFOX_B}
Capture And Compare    home    ${CAPTURES_DIR}
Click Element    css=a[href="/photographie"]
Capture And Compare    after-click    ${CAPTURES_DIR}
[Teardown]    Close Versions

Keywords

Keyword Role
Open Versions open the URL in both Firefox instances
Go To navigate to a URL
Click Element click (css=, id=, xpath=…)
Input Text type text
Go Back previous page
Capture And Compare capture + diff + result.json
Load Storage State inject cookies + localStorage (authenticated session)
Close Versions close both browsers

Output

Each Capture And Compare produces a folder with version_a.png, version_b.png, diff.png, and a result.json:

{
  "difference_percent": 0.0,
  "first_diff_y": null,
  "firefox_a": "152.0.1",
  "firefox_b": "128.0"
}

Documentation

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

selenium_screenshot_compare-0.3.0.tar.gz (85.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

selenium_screenshot_compare-0.3.0-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file selenium_screenshot_compare-0.3.0.tar.gz.

File metadata

File hashes

Hashes for selenium_screenshot_compare-0.3.0.tar.gz
Algorithm Hash digest
SHA256 9dfda9a1f046bcc88870ce063dbe0b4e8eafc98b750c9c3c0d20e52eabc1ba06
MD5 df4a37c3ff5fe4fcb47a1b17983eccd2
BLAKE2b-256 acbae6adb858dd9990020563040010f1d90a28827d23c25abcd29e023b2ea3df

See more details on using hashes here.

Provenance

The following attestation bundles were made for selenium_screenshot_compare-0.3.0.tar.gz:

Publisher: auto-tag.yml on EAnathos/selenium-screenshot-compare

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file selenium_screenshot_compare-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for selenium_screenshot_compare-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee08614518a6fa5b10861bbc923f914ea1a8c7f401945d020fe0db9d0a4dc710
MD5 eb4a8d43e2bb8123c30d08624073067a
BLAKE2b-256 5c1be849d5723ec64452418f3e0f7f9d4379139f4c9b0ddb97c4eef3c1d4c2da

See more details on using hashes here.

Provenance

The following attestation bundles were made for selenium_screenshot_compare-0.3.0-py3-none-any.whl:

Publisher: auto-tag.yml on EAnathos/selenium-screenshot-compare

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 files

0.2.1

2 files

0.2.0

2 files

0.1.2

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page