Appearance
UI.LocalStorage.set()
Sets the value of an item in the browser’s local storage for the current page.
Local storage is scoped to the origin of the current page (protocol, domain, and port). This command can only write items for the same origin that the test is currently running on.
If the item already exists in local storage, the value is overwritten.
Usage
js
UI.LocalStorage.set(key: string, value: any)Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | The key of the local storage item to set. |
value | any | The value to store in local storage. If the value is not a string, it will be stringified before storing. |
Examples
js
UI.LocalStorage.set("theme", {"dark_mode": true})Sets the theme item in local storage to {"dark_mode": true}.