Build automation scripts that survive UI updates. Replace brittle XPath selectors with semantic understanding.
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.
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.
Send the URL to our Geometry Engine (`map` mode). We render the DOM and extract all interactive elements.
Our response includes semantic data: `role`, `text`, `attributes`. Your script finds the element matching specific criteria (e.g., Role="button" AND Text="Sign In").
Use the returned robust `selector` or precise `bbox` coordinates to drive your Selenium/Puppeteer/Playwright instance.
Resilient automation patterns
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.
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.
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.