Skip to content

Add support for background page creation (#14547)#3136

Merged
kblok merged 2 commits intomasterfrom
implement-upstream-change-14547
Feb 16, 2026
Merged

Add support for background page creation (#14547)#3136
kblok merged 2 commits intomasterfrom
implement-upstream-change-14547

Conversation

@kblok
Copy link
Member

@kblok kblok commented Feb 15, 2026

Summary

  • Ports upstream Puppeteer PR #14547 which adds a background flag when creating pages
  • Adds CreatePageOptions class with a Background property
  • Updates NewPageAsync on IBrowser, IBrowserContext, and all implementations (CDP and BiDi) to accept CreatePageOptions
  • CDP: passes background to Target.createTarget
  • BiDi: passes background via IsCreatedInBackground on CreateCommandParameters

Changes

File Change
CreatePageOptions.cs New class with Background property
IBrowser.cs / IBrowserContext.cs Updated NewPageAsync signature
Browser.cs / BrowserContext.cs Updated abstract method signatures
CdpBrowser.cs / CdpBrowserContext.cs Pass background to Target.createTarget
BidiBrowser.cs / BidiBrowserContext.cs Pass background to BiDi browsing context creation
UserContext.cs Accept background param and set IsCreatedInBackground
TargetCreateTargetRequest.cs Added Background property
NewPageTests.cs Test verifying document.visibilityState is "hidden"

Test plan

  • Chrome/CDP: NewPageTests.ShouldCreateABackgroundPage passes
  • Firefox/BiDi: NewPageTests.ShouldCreateABackgroundPage passes
  • Chrome/CDP: All PageTests pass (145 passed, 4 skipped)
  • Firefox/BiDi: All PageTests pass (123 passed, 26 skipped)
  • Chrome/CDP: All BrowserContextTests pass (21 passed, 1 skipped)

🤖 Generated with Claude Code

kblok and others added 2 commits February 15, 2026 18:00
Port upstream Puppeteer PR #14547 which adds a `background` flag to
page creation. When set to true, the new page is created in the
background with `document.visibilityState` equal to "hidden".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The upstream CreatePageOptions includes type (tab/window),
windowBounds, and background. Update our implementation to match
by adding WindowBounds, WindowState, and passing window properties
through CDP Target.createTarget and BiDi browsingContext.create.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant