Skip to content

Allow passing an existing BrowserContext instance to createServer for more flexibility #229

@adcentury

Description

@adcentury

Would it be possible to support passing in an existing BrowserContext?

Right now, createServer() handles the creation/connecting of the Playwright browser internally, which works fine for many cases. But in more advanced setups, you might already have a context.

For example:

  • A developer already has a fully configured launchPersistentContext(), like login state, extensions, or other settings
  • The context is being managed externally (e.g. injected via dependency)

I know remoteEndpoint is an option, but sometimes passing a context directly is just simpler for local use cases.

I can create a PR about this feature if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions