Skip to content

fix(highlight): resolve highlights relative to the frame of the locator - #42868

Merged
Yury Semikhatsky (yury-s) merged 1 commit into
microsoft:mainfrom
yury-s:fix-42850
Sep 23, 2026
Merged

Yury Semikhatsky (yury-s) merged 1 commit into
microsoft:mainfrom
yury-s:fix-42850

Conversation

@yury-s

Copy link
Copy Markdown
Member

Summary

  • HighlightController resolved every selector from the main frame, so frame.locator(...).highlight() highlighted elements in the page instead of the frame
  • Thread the frame through the highlight entry, key entries by frame so the same selector can be highlighted from different frames, and drop entries when their frame detaches

Fixes #42850

HighlightController resolved every selector from the main frame, so
frame.locator(...).highlight() highlighted elements in the page instead
of the frame. Thread the frame through the highlight entry and key the
entries by frame, so the same selector can be highlighted from
different frames.

Fixes: microsoft#42850
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

4 flaky ⚠️ [chromium-library] › library/browsercontext-page-event.spec.ts:173 › should work with Ctrl-clicking `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/video.spec.ts:762 › screencast › should work with video+trace `@realtime-time-library-chromium-linux`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:257 › third party 'Partitioned;' cookies `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:470 › top level 'Partitioned;' cookie and same origin iframe `@firefox-ubuntu-22.04-node20`

52160 passed, 1253 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

2 failed
❌ [chrome] › mcp/cli-webmcp.spec.ts:135 › webmcp-list stitches tools across frames @mcp-macos-latest-chrome
❌ [firefox] › mcp/cli-session.spec.ts:54 › idle timeout shuts the session down @mcp-windows-latest-firefox

8690 passed, 1474 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

🟢 Both failures are pre-existing flakes — this PR is clear

Hi, I'm the Playwright bot and I triaged the red CI here. The two failures are both MCP tests that
fail the same way on other people's PRs, and neither touches the highlight code this PR changes.

Details

The diff is confined to highlightController.ts / frameDispatcher.ts (Frame.highlight /
Frame.hideHighlight) plus a new tests/library/locator-highlight.spec.ts case. HighlightController
only does work once highlight() is called, and no MCP test in this report calls it. The library
suite that does cover the changed code is fully green (52160 passed, 4 unrelated flaky).

Pre-existing flake / infra

I'm a first pass, not the final word — but nothing in the evidence points at this change.

Triaged by the Playwright bot - agent run

@yury-s
Yury Semikhatsky (yury-s) merged commit cd16010 into microsoft:main Sep 23, 2026
43 of 45 checks passed
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.

[Bug]: 1.63 regression - page.frame(...).locator(...).highlight highlights elements in the wrong frame

2 participants