Docs/Use Cases/Self_Healing_RPA

Self-Healing Automation & RPA

Build automation scripts that survive UI updates. Replace brittle XPath selectors with semantic understanding.

The "Broken Selector" Crisis

Traditional automation relies on rigid CSS or XPath selectors. When a developer changes a class name or wraps a `div`, your bots crash.

Brittle Selectors

/html/body/div[2]/div/button[1]

Breaks instantly if the page layout shifts by even one pixel or one tag.

Maintenance Hell

Engineers spend up to 30% of their time just fixing broken scraping scripts after site updates.

The Solution: Semantic Discovery

Instead of looking for div#btn-123, ask Sentience to find "The Login Button". The API analyzes the page structurally and semantically to locate elements regardless of underlying code changes.

1

Observe

Send the URL to our Geometry Engine (`map` mode). We render the DOM and extract all interactive elements.

2

Filter & Match

Our response includes semantic data: `role`, `text`, `attributes`. Your script finds the element matching specific criteria (e.g., Role="button" AND Text="Sign In").

3

Act

Use the returned robust `selector` or precise `bbox` coordinates to drive your Selenium/Puppeteer/Playwright instance.

Workflow Examples

Resilient automation patterns

Self-Healing Selector Lookup

Dynamically fetch valid selectors at runtime instead of hardcoding them:

1def find_element_resilient(url, target_text, target_role):
2    # 1. Ask Sentience what is on the page right now
3    response = sentience.observe(url, mode="map")
4
5    # 2. Find the element semantically (not by ID/Class)
6    for element in response["interactable_elements"]:
7        if (element["text"].lower() == target_text.lower() and
8            element["role"] == target_role):
9
10            # 3. Return a working selector or coordinates
11            return element["selector"] # e.g., "button[data-testid='submit-v2']"
12
13# Usage in Playwright/Selenium
14selector = find_element_resilient(driver.current_url, "Checkout", "button")
15driver.click(selector)

✅ Outcome: If the "Checkout" button ID changes from `#btn-1` to `#btn-final`, this script still works.

Dynamic Form Filling

Identify form fields by their semantic purpose (email, password) rather than position:

1// API Request
2{
3  "url": "https://signup.example.com",
4  "mode": "map",
5  "options": {
6    "filter": {
7      "allowed_roles": ["textbox", "button"]
8    }
9  }
10}
11
12// Logic:
13// 1. Find element where attributes.type = "email" OR text contains "Email"
14// 2. Find element where attributes.type = "password"
15// 3. Find button where text contains "Sign Up"

✅ Outcome: Automates forms across different websites without site-specific code.

Maintenance Comparison

Hardcoded Selectors

Reliability: Low (Breaks on updates)

Setup Time: Fast initially

Maintenance: High (Weekly fixes)

Sentience Semantic Lookup

Reliability: High (Adapts to changes)

Setup Time: Moderate (API integration)

Maintenance: Near Zero

Zero-Maintenance Scripts

Stop waking up to broken bots. Let the API find the elements for you.