Skip to content

[Feature] API for changing localStorage #6258

@djasnowski

Description

@djasnowski

I'm trying to get the localStorage of an app via:

const storage = await context.storageState(); and it outputs: { cookies: [], origins: [] }

and then I try:

    const localStorage = await page.evaluate(() =>
      JSON.stringify(window.localStorage)
    );
    console.log(localStorage);

and I get: page.evaluate: Evaluation failed: DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.

I know this page has localStorage because In between tests, I can see the localStorage in the Application tab.

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