English · Java
Appearance
English · Java
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().
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();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