Auto-Match — Self-Healing Selectors

Auto-Match automatically repairs broken CSS or XPath selectors in production using multi-dimensional DOM fingerprints stored in an embedded Sled database.

5 min read Updated July 2026

How It Works

  1. First Match: When a selector matches an element, Auto-Match generates a multi-dimensional DOM fingerprint (tag, classes, ID, parent tags, depth, text hash).
  2. Fingerprint Cached: The fingerprint is cached in an embedded Sled database (.crawlingo/).
  3. Auto-Healing: If a website redesign breaks the selector, Auto-Match scans candidate nodes, runs Jaro-Winkler similarity comparisons against stored fingerprints, and binds the correct element.

Usage

auto_match.py
python
1from crawlingo import Page, Session, Dataset
2
3# Enable on Page
4page = Page("https://example.com").auto_match(True)
5
6# Enable on Dataset
7dataset = Dataset("https://example.com").auto_match(True)
8
9# Enable on Session (applies to all pages/datasets sharing session)
10session = Session().auto_match(True)
11page = Page("https://example.com", session=session)

Fingerprint Components & Default Weights

FeatureDefault WeightDescription
tag1.0HTML element tag (div, span, h1, etc.)
class_name0.8CSS class list comparison
id0.6Element ID attribute
attributes0.4All key-value attribute pairs
parent_tag0.5Parent DOM node tag name

Custom Similarity Weights

weights.py
python
1session.auto_match_weights({
2 "tag": 1.0,
3 "class_name": 0.9,
4 "id": 0.7,
5 "attributes": 0.5,
6 "parent_tag": 0.6,
7})