[fix]: support <frame> elements in XPath frame detection
Merged
SH
9mo ago+59+59+01234567890123456789-6-6-0123456789
Summary
IFRAME_STEP_REregex only matchediframesteps, causingact()to fail on legacy<frameset>pages whereobserve()returns XPaths containingframe[N](e.g./html[1]/frameset[1]/frame[4]/html[1]/body[1]/...)- Changed regex from
/^iframe(?:\[\d+])?$/ito/^i?frame(?:\[\d+])?$/iso both<iframe>and<frame>are recognized as frame boundaries - Consolidated the duplicate
IFRAME_STEP_REconstant (was defined in bothdeepLocator.tsandfocusSelectors.ts) into a single shared export
Test plan
- Scratchpad repro confirms current regex misses
frame,frame[4],FRAMEā all pass with fix - 10 new unit tests added to
snapshot-focus-selectors-utils.test.tscovering:- Regex matches
iframe,iframe[N],frame,frame[N](case-insensitive) - Regex rejects
frameset,frameset[N],div,body,html - Full XPath parse + walk for frameset page XPaths detects correct frame boundary
- Standard iframe XPaths still detected correctly
framesetis not false-positive detected as a frame boundary
- Regex matches
- All 15 tests pass, build + typecheck pass
š¤ Generated with Claude Code
Summary by cubic
Adds support for in XPath frame boundary detection so navigation works on legacy pages. iframe and frame steps are treated as frame boundaries.
-
Bug Fixes
- Updated regex from /^iframe(?:[\d+])?$/i to /^i?frame(?:[\d+])?$/i to match iframe and frame (case-insensitive) without matching frameset.
- Added focused tests for iframe/frame and frameset XPaths, including parse + boundary detection; trimmed low-value cases.
- Added a changeset for a patch release.
-
Refactors
- Consolidated IFRAME_STEP_RE into a shared export from focusSelectors and used it in deepLocator.