You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
deepLocator deep-XPath only treats positionally-indexed iframe steps as frame hops — iframe[@name='…'] paths resolve in the wrong frame #3416
So iframe[2] is recognized as a hop, but any iframe step that selects by an attribute predicate — iframe[@name='main'], iframe[@id='content'], iframe[2][@title='x'] — fails the regex, is not planned as a hop, and the remaining path is resolved in the parent frame. The lookup then fails (or resolves to nothing) even though the target element exists inside that iframe.
Hand-written deep XPaths that select the iframe by attribute therefore can never cross the frame boundary, while the same selector written with a positional predicate works.
Observe frameHopSelectors is empty and the whole path becomes the final in-frame selector.
Compare with planDeepXPathTarget("//iframe[1]//button"), which correctly hops.
Minimal Reproduction Code
Pure-function repro, no browser needed, in the style of packages/extension/tests/deep-locator.test.ts (verified on main, 2026-11-08: the positional form hops, the attribute form does not):
import{expect,it}from"vitest";import{planDeepXPathTarget}from"../understudy/deepLocator.js";it("plans a hop for an iframe selected by attribute predicate",()=>{expect(planDeepXPathTarget("//iframe[@name='main']//button")).toEqual({frameHopSelectors: ["xpath=//iframe[@name='main']"],finalSelector: "xpath=//button",});// Actual: frameHopSelectors: [] — the iframe step is kept in the final// selector and resolved as an element in the parent frame.});
Suggested direction
Broaden the hop test so the step name is checked before predicates are considered, e.g. strip all bracketed predicates for the name test (raw.replace(/\[[^\]]*\]/g, "")) or test /^i?frame\b/i against the token before the first [. Positional predicates on the hop selector should stay in buildXPathFromSteps output either way, since the hop selector itself must still select the right iframe element.
Activity