- CSS Selectors
- Playwright Extensions
- XPath
- Shadow DOM
Testing Selectors
Figranium provides multiple tools for finding and verifying selectors:Built-in Highlight Tool
Click the selector/crosshair icon in any action block’s selector field. This activates a visual picker in the headful browser that lets you hover over and click elements on the live page. When you click an element, Figranium generates up to five selector candidates ranked by stability and readability. The top candidate is automatically inserted into the selector field, and the remaining alternatives appear as clickable pill buttons below the input. Click any alternative to switch. The selector generation algorithm prioritizes selectors in this order:- Name and placeholder attributes —
[name="email"],[placeholder="Search..."] - Text content —
:has-text("Submit")for buttons, links, and labels - Semantic attributes —
[aria-label="Close"],[title="Settings"],[alt="Logo"] - Data attributes —
[data-testid="login-btn"],[data-cy="submit"] - IDs —
#checkout-form(skips random or obfuscated IDs) - Other attributes —
[type="submit"],[href="/account"] - Classes —
.product-card(skips auto-generated hashes like.sc-abc123) - Structural fallback —
tag:nth-of-type(n)or parent path
AI Selector Generator
Uses AI (Gemini or Claude) to generate robust, semantically meaningful selectors. It analyzes the page structure and suggests selectors that are more resilient to minor HTML changes. Configure your AI provider keys in Settings > System > API Keys and choose the preferred model in Settings > System > AI Models. Set your preferred default selector tool in Settings > System > Selector Finder.Browser Developer Tools
1
Inspect the element
Right-click an element > Inspect.
2
Search for matches
In the Elements panel, press
Ctrl+F (or Cmd+F on Mac).3
Type and verify
Type a CSS selector or XPath to see highlighted matches in real-time.
4
Copy the selector
Right-click the element in the Elements tree > Copy > Copy selector for an auto-generated selector.
Testing in the Browser Console
Verify a selector in DevTools console:Best Practices
- Prefer IDs and
data-*attributes: IDs (#submit) and test attributes ([data-testid="submit"]) are the most stable because they are explicitly set by developers and less likely to change with styling updates. - Avoid long chains:
body > div > div > section > ul > li > spanbreaks as soon as the HTML structure changes. Use a more specific class or attribute closer to the element. - Use
:has-text()for dynamic buttons: When a button’s text is the most stable thing about it, usebutton:has-text("Add to Cart")rather than a brittle class like.btn-blue-v2. - Scope your selectors: Instead of
.item, use.product-list .itemto avoid accidentally matching elements in other parts of the page. - Avoid nth-child on large lists:
li:nth-child(7)breaks when items are added/removed. Use a data attribute or text match instead. - Test after site updates: Websites change. Pin important selectors to stable attributes and review them periodically.