English · .NET
Appearance
English · .NET
Appearance
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.GotoAsync("https://example.com");
await page.LocalStorage.SetItemAsync("token", "abc");
var token = await page.LocalStorage.GetItemAsync("token");
var all = await page.LocalStorage.ItemsAsync();
await page.LocalStorage.RemoveItemAsync("token");
await page.LocalStorage.ClearAsync();Removes all items from the storage.
Returns the value for the given name if present.
Arguments
Returns
null | stringReturns all items in the storage as name/value pairs.
Returns
Array<Object>Removes the item with the given name. No-op if the item is absent.
Arguments
Sets the value for the given name. Overwrites any existing value for that name.
Arguments