effect-playwright
    Preparing search index...

    Interface WebStorage

    WebStorage exposes the page's localStorage or sessionStorage for the current origin via an async, browser-consistent API.

    Instances are accessed through page.localStorage and page.sessionStorage.

    await page.goto('https://example.com');
    await page.localStorage.setItem('token', 'abc');
    const token = await page.localStorage.getItem('token');
    const all = await page.localStorage.items();
    await page.localStorage.removeItem('token');
    await page.localStorage.clear();
    interface WebStorage {
        clear(): Promise<void>;
        getItem(name: string): Promise<string | null>;
        items(): Promise<{ name: string; value: string }[]>;
        removeItem(name: string): Promise<void>;
        setItem(name: string, value: string): Promise<void>;
    }
    Index
    • Removes all items from the storage.

      Returns Promise<void>

    • Returns the value for the given name if present.

      Parameters

      • name: string

        Name of the item to retrieve.

      Returns Promise<string | null>

    • Returns all items in the storage as name/value pairs.

      Returns Promise<{ name: string; value: string }[]>

    • Removes the item with the given name. No-op if the item is absent.

      Parameters

      • name: string

        Name of the item to remove.

      Returns Promise<void>

    • Sets the value for the given name. Overwrites any existing value for that name.

      Parameters

      • name: string

        Name of the item to set.

      • value: string

        New value for the item.

      Returns Promise<void>