Skip to content

chore(highlight): resolve highlights periodically in HighlightController - #42277

Merged
Dmitry Gozman (dgozman) merged 1 commit into
microsoft:mainfrom
dgozman:highlight-controller
Aug 17, 2026
Merged

Dmitry Gozman (dgozman) merged 1 commit into
microsoft:mainfrom
dgozman:highlight-controller

Conversation

@dgozman

Copy link
Copy Markdown
Collaborator

Summary

  • Each page has a HighlightController that keeps the list of highlighted selectors and re-resolves them across frames once a second, so highlights survive navigations, newly attached frames and DOM changes.
  • Highlights can optionally pierce frames; the recorder uses this for user-typed selectors and aria templates, restoring cross-frame highlighting ([Feature]: locators in iframes not getting highlighted in Chromium or any browser #33146).
  • Frame.addHighlight/removeHighlight/hideHighlight and Page.hideHighlight are replaced by HighlightController methods.
  • The injected script renders highlights through a single setHighlights() call per frame that replaces all element highlights at once.
  • The pierce/noDefaultPierce selector resolution options are merged into a single tri-state pierce option.

Each page now has a HighlightController that keeps a list of highlighted
selectors and resolves them across frames once a second, so that
highlights survive navigations, newly attached frames and DOM changes.
Highlights can optionally pierce frames, which is used by the recorder
for user-typed selectors and aria templates.

- Frame.addHighlight/removeHighlight/hideHighlight and Page.hideHighlight
  are replaced by the HighlightController methods.
- The injected script renders highlights with a single setHighlights()
  call per frame, which replaces all element highlights at once.
- The 'pierce' and 'noDefaultPierce' resolution options are merged into
  a single tri-state 'pierce' option.
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

2 failed
❌ [chromium] › mcp/cli-killall.spec.ts:42 › kill-all kills filtered dashboard pid @mcp-ubuntu-latest-chromium
❌ [firefox] › mcp/cli-devtools.spec.ts:84 › request shows full request and response details @mcp-windows-latest-firefox

8099 passed, 1311 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

23 flaky ⚠️ [chromium-library] › library/global-fetch.spec.ts:293 › should return security details from response `@frozen-time-library-chromium-linux`
⚠️ [chromium-library] › library/har.spec.ts:639 › should have security details `@frozen-time-library-chromium-linux`
⚠️ [chromium-library] › library/chromium/chromium.spec.ts:301 › should report intercepted service worker requests in HAR `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/global-fetch.spec.ts:293 › should return security details from response `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/har.spec.ts:639 › should have security details `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/global-fetch.spec.ts:293 › should return security details from response `@realtime-time-library-chromium-linux`
⚠️ [chromium-library] › library/har.spec.ts:639 › should have security details `@realtime-time-library-chromium-linux`
⚠️ [chromium-library] › library/chromium/chromium.spec.ts:436 › should produce network events, routing, and annotations for Service Worker (advanced) `@chromium-ubuntu-22.04-node24`
⚠️ [chromium-library] › library/global-fetch.spec.ts:293 › should return security details from response `@chromium-ubuntu-22.04-node24`
⚠️ [chromium-library] › library/har.spec.ts:639 › should have security details `@chromium-ubuntu-22.04-node24`
⚠️ [chromium-library] › library/chromium/chromium.spec.ts:436 › should produce network events, routing, and annotations for Service Worker (advanced) `@chromium-ubuntu-22.04-node20`
⚠️ [chromium-library] › library/global-fetch.spec.ts:293 › should return security details from response `@chromium-ubuntu-22.04-node20`
⚠️ [chromium-library] › library/har.spec.ts:639 › should have security details `@chromium-ubuntu-22.04-node20`
⚠️ [chromium-library] › library/video.spec.ts:495 › screencast › should capture static page in persistent context Radoslav Kirilov (@smoke) `@chromium-ubuntu-22.04-node20`
⚠️ [chromium-library] › library/global-fetch.spec.ts:293 › should return security details from response `@chromium-ubuntu-22.04-node22`
⚠️ [chromium-library] › library/har.spec.ts:639 › should have security details `@chromium-ubuntu-22.04-node22`
⚠️ [firefox-library] › library/global-fetch.spec.ts:293 › should return security details from response `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-library] › library/har.spec.ts:639 › should have security details `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-library] › library/heap.spec.ts:223 › should not leak workers `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-page] › page/page-emulate-media.spec.ts:144 › should keep reduced motion and color emulation after reload `@firefox-ubuntu-22.04-node20`
⚠️ [webkit-library] › library/global-fetch.spec.ts:293 › should return security details from response `@webkit-ubuntu-22.04-node20`
⚠️ [webkit-library] › library/har.spec.ts:639 › should have security details `@webkit-ubuntu-22.04-node20`
⚠️ [webkit-page] › page/page-network-request.spec.ts:288 › should parse the data if content-type is application/x-www-form-urlencoded `@webkit-ubuntu-22.04-node20`

51122 passed, 1220 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Hi, I'm the Playwright bot and I took a first look at the CI failures here.

🟢 CI is clear — both failures are pre-existing flakes

The two red MCP tests both flip verdict across hundreds of unrelated runs, and neither exercises anything this PR touches (highlights, frame selectors, screenshotter). Nothing to fix here.

Details

This PR reworks highlight rendering (HighlightController, injected highlight.ts, frameSelectors, pierce option). The only real failures are two MCP CLI tests that don't touch any of that code path.

Pre-existing flake / infra

  • [chromium] › mcp/cli-killall.spec.ts:42 › kill-all kills filtered dashboard pid (@mcp-ubuntu-latest-chromium) — established flake. On this exact bot it failed 6 of 729 runs and passed the rest, flipping across SHAs unrelated to this PR (chromium overall: 9 failed / 721 passed). It's a process-kill/PID-filter test, untouched by the highlight changes.

  • [firefox] › mcp/cli-devtools.spec.ts:84 › request shows full request and response details (@mcp-windows-latest-firefox) — established flake. On this exact bot it failed 8 of 558 runs and passed the rest, flipping across unrelated SHAs (firefox overall: 5 failed / 718 passed). It asserts on request/response detail output, unrelated to highlighting.

The "tests 1" report shows only flaky/rescued results (0 real failures), so there's nothing else to triage.

Triaged by the Playwright bot - agent run

Comment thread packages/playwright-core/src/server/highlightController.ts
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