Skip to content

fix(frames): treat elements inside hidden iframes as hidden - #42884

Merged
Dmitry Gozman (dgozman) merged 2 commits into
microsoft:mainfrom
dgozman:fix-42719
Sep 24, 2026
Merged

Dmitry Gozman (dgozman) merged 2 commits into
microsoft:mainfrom
dgozman:fix-42719

Conversation

@dgozman

Copy link
Copy Markdown
Collaborator

Summary

  • Frame element visibility is determined during selector resolution and passed to the injected script, so elements inside a visibility: hidden iframe are considered hidden, including cross-origin frames.
  • Actions that wait for visibility bail out early and retry while the frame is hidden.
  • frameVisible is a required argument for elementState() visibility checks.

Fixes #42719

Frame visibility is determined during selector resolution and passed
to the injected script, so that elements inside a hidden frame element
are never considered visible, including cross-origin frames.

Fixes microsoft#42719
Make frameVisible a required argument of elementState() for 'visible'
and 'hidden' states, and plumb it explicitly from locator resolution
and ElementHandle api methods.
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

6 flaky ⚠️ [installation tests] › playwright-cli.spec.ts:21 › cli should work `@package-installations-ubuntu-latest`
⚠️ [chromium-library] › library/video.spec.ts:521 › screencast › should capture static page in persistent context Radoslav Kirilov (@smoke) `@realtime-time-library-chromium-linux`
⚠️ [chromium-library] › library/popup.spec.ts:260 › should not throw when click closes popup `@chromium-ubuntu-22.04-node24`
⚠️ [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`
⚠️ [webkit-page] › page/page-leaks.spec.ts:136 › expect should not leak `@webkit-ubuntu-22.04-node20`

52122 passed, 1241 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

1 failed
❌ [firefox] › mcp/cli-devtools.spec.ts:140 › request* and response* commands support --filename @mcp-windows-latest-firefox

8704 passed, 1474 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

🟢 CI is clear — the one failure is a known flake

Hi, I'm the Playwright bot and I triaged the failing CI run.

The only real failure is [firefox] › mcp/cli-devtools.spec.ts:140 › request* and response* commands support --filename on mcp-windows-latest-firefox. It has failed with the identical error on four other unrelated PRs, so it isn't yours.

Details

This PR touches iframe visibility resolution (injectedScript.ts, dom.ts, frameSelectors.ts, frames.ts, screenshotter.ts). Nothing in that path is exercised by the MCP devtools CLI request/response commands, and the assertion that fails is about a saved --filename artifact, not element state.

Pre-existing flake / infra

The six flaky entries in the "tests 1" report (installation CLI, video.spec.ts:521, popup.spec.ts:260, two third-party cookie tests, page-leaks.spec.ts:136) all passed on retry and are spread across browsers and unrelated areas — nothing to triage there.

I'd just re-run the MCP job.

Triaged by the Playwright bot - agent run

@dgozman
Dmitry Gozman (dgozman) merged commit b7957c5 into microsoft:main Sep 24, 2026
44 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]: frame with visibility: hidden is incorrectly treated as visible

2 participants