Skip to content

Conversation

@sebbrinkworth
Copy link

@sebbrinkworth sebbrinkworth commented Jan 16, 2026

PR for Feature Request #1555

  • Add preferredSelectorType to options
  • Update DOM snapshot to capture id, class, and data-testid
  • Implement safe selector generation priority
  • Update ActHandler to use stable selectors when preferred
  • Ensure strict backward compatibility (XPath default)"

Summary by cubic

Implements stable selectors (id, CSS, data-attributes) across snapshots and action handling to reduce flakiness, while keeping XPath as the default for full backward compatibility. Adds a preferredSelectorType option and updates handlers to pick the best selector automatically. Aligns with Linear #1555.

  • New Features
    • Add V3Options.preferredSelectorType: "id" | "css" | "xpath" (default: xpath).
    • Capture id, computed CSS selector (prefers data-testid, then id, else class-based), and all attributes in snapshots; expose combinedIdMap, combinedCssSelectorMap, combinedAttributesMap.
    • Normalize Action to include selector, id, cssSelector, attributes; ActHandler selects the best selector per preference and falls back to XPath; self-heal/retries use the same logic.
    • ObserveHandler now returns Actions populated with id/css/attributes.
    • Update ActCache invalidation to react to id/css/attributes changes.
    • Expand public/private types and tests to cover new selector data; no breaking changes.

Written for commit 9dde58d. Summary will update on new commits.

@changeset-bot
Copy link

changeset-bot bot commented Jan 16, 2026

⚠️ No Changeset found

Latest commit: 9dde58d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@riturajFi
Copy link

Hey @sebbrinkworth! The PR is interesting. Anything i can add on top of this? Would love to contribute

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants