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
[Bug]: 1.63 regression - Locator.highlight does not work with custom selector engines that rely on global variables #42849
both button.highlight and button.click should work
Actual behavior
only button.click works.
it seems that window.selectorEngineEnabled is undefined when called by locator.highlight, but not when called by locator.click.
my guess is that maybe locator.highlight is incorrectly running the selector inside an isolated content script, even though the selector engine is not being registered with {contentScript: true}?
Confirmed on main with a small variation of the repro — a custom engine whose queryAll gates on a global set via page.evaluate, and click() resolves fine while .highlight() draws nothing.
The difference between the two is which world they run in. Selectors that use an engine registered without contentScript: true are parsed with world: 'main', so actions evaluate them in the main world where window.selectorEngineEnabled (or window.sap in the ui5 case) is visible. The HighlightController from #42277 only renders in the utility world though — _resolve() goes through frame.existingContext('utility'), and the injected highlight re-queries the selector there on every animation frame. In the isolated world those globals are undefined, so the engine matches nothing and there's nothing to draw.
I've just sent #42854 for the sibling #42850 (wrong-frame highlights) — this one is a separate defect and still reproduces with that fix applied. The plan here is to apply each highlight in the world its selector resolved to (the resolution step already computes info.world), and to make hideHighlights() clear both worlds, since the screenshotter relies on that before capturing. Happy to take this one unless someone is already on it.
Activity
ashrafiucse commentedon Sep 22, 2026
Confirmed on main with a small variation of the repro — a custom engine whose
queryAllgates on a global set viapage.evaluate, andclick()resolves fine while.highlight()draws nothing.The difference between the two is which world they run in. Selectors that use an engine registered without
contentScript: trueare parsed withworld: 'main', so actions evaluate them in the main world wherewindow.selectorEngineEnabled(orwindow.sapin the ui5 case) is visible. TheHighlightControllerfrom #42277 only renders in the utility world though —_resolve()goes throughframe.existingContext('utility'), and the injected highlight re-queries the selector there on every animation frame. In the isolated world those globals are undefined, so the engine matches nothing and there's nothing to draw.I've just sent #42854 for the sibling #42850 (wrong-frame highlights) — this one is a separate defect and still reproduces with that fix applied. The plan here is to apply each highlight in the world its selector resolved to (the resolution step already computes
info.world), and to makehideHighlights()clear both worlds, since the screenshotter relies on that before capturing. Happy to take this one unless someone is already on it.