Selectors and Resilience
How Agent Mantis finds elements on the page and adapts when they change.
Selector strategy
Agent Mantis uses a multi-layered approach:
- Semantic understanding — AI interprets the intent ("the login button")
- Best selector — Picks the most stable selector available
- Fallback chain — If the primary selector fails, tries alternatives
- Self-healing — Updates selectors based on page analysis
Selector priority
data-testidattributes (most stable)- ARIA roles and labels
- Text content
- CSS selectors
- XPath (last resort)
Recording vs resilient automation
Traditional record-and-playback tools capture exact selectors at recording time. When the UI changes, tests break.
Agent Mantis uses AI to understand intent, not just selectors. This means tests survive UI refactors that would break traditional tools.