Skip to content

[Feature]: browserType.launchPersistentContext: populate context with given storage state #7634

@badsyntax

Description

@badsyntax

Feature request

Hi there.

It would be really handy to be able to populate a persistent context with auth state, similar to browser.newContext({ storageState: 'state.json' }).

I am generating auth-state (state.json) in my globalSetup, and I'm using a persistent context to allow lighthouse to run on authenticated routes, but I currently have to manually setup the user session by manually "injecting" auth state from the saved "state.json" file. It would be really convenient if I could do this instead:

const context = await chromium.launchPersistentContext(userDataDir, {
  args: [`--remote-debugging-port=${port}`, '--lang=en-GB'],
  storageState: 'state.json'
});

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions