docs/src/api/class-webstorage.md
WebStorage exposes the page's localStorage or sessionStorage for the current origin via an async,
browser-consistent API.
Instances are accessed through [property: Page.localStorage] and [property: 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();
await page.goto("https://example.com")
await page.local_storage.set_item("token", "abc")
token = await page.local_storage.get_item("token")
all = await page.local_storage.items()
await page.local_storage.remove_item("token")
await page.local_storage.clear()
page.goto("https://example.com")
page.local_storage.set_item("token", "abc")
token = page.local_storage.get_item("token")
all = page.local_storage.items()
page.local_storage.remove_item("token")
page.local_storage.clear()
page.navigate("https://example.com");
page.localStorage().setItem("token", "abc");
String token = page.localStorage().getItem("token");
List<WebStorageItem> all = page.localStorage().items();
page.localStorage().removeItem("token");
page.localStorage().clear();
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();
name <[string]>value <[string]>Returns all items in the storage as name/value pairs.
Returns the value for the given [param: WebStorage.getItem.name] if present.
name <[string]>Name of the item to retrieve.
Sets the value for the given [param: WebStorage.setItem.name]. Overwrites any existing value for that name.
name <[string]>Name of the item to set.
value <[string]>New value for the item.
Removes the item with the given [param: WebStorage.removeItem.name]. No-op if the item is absent.
name <[string]>Name of the item to remove.
Removes all items from the storage.