Back to Documentation

Understanding Selectors

AutoSmoke uses AI to intelligently find elements on your page, so you don't need to write CSS selectors or XPath expressions.

How It Works

When you write a step like:

Click the "Sign Up" button

Our AI:

  1. Analyzes the page structure
  2. Identifies all potential matches
  3. Uses context to select the correct element
  4. Falls back to alternative selectors if needed

Self-Healing Selectors

Traditional tests break when:

  • CSS classes change
  • Element IDs are updated
  • DOM structure is reorganized

AutoSmoke's self-healing technology adapts to these changes automatically by:

  • Using multiple selector strategies
  • Prioritizing stable attributes (text, labels, roles)
  • Learning from successful past executions

Providing Hints

While AutoSmoke usually finds elements correctly, you can provide hints for precision:

Using Text Content

Click the button with text "Submit Order"

Using Position

Click the first "Add to Cart" button
Click the "Delete" button next to "Product Name"

Using Section Context

In the header, click the "Login" link
In the sidebar, click "Settings"

Handling Ambiguous Elements

If multiple elements match your description:

  1. AutoSmoke will attempt to identify the most likely match
  2. If uncertain, it will ask for clarification
  3. You can provide more context to disambiguate

Example: Multiple Buttons

❌ Click the "Submit" button (ambiguous if multiple exist)
✅ Click the "Submit" button in the payment form
✅ Click the primary "Submit" button

Accessibility and Testing

AutoSmoke works best with accessible websites because:

  • Proper labels help identify form fields
  • ARIA roles indicate element purposes
  • Semantic HTML provides context

This is a win-win: accessible sites are easier to test AND better for users.