The Browser/localStorageGet extension retrieves the value stored against a specific key in the browser's localStorage for the current page context.
This is useful when a journey needs to reuse a value already stored by the application or by a related local storage setup extension, such as an authentication code, feature flag, session marker, or test data value.
Parameters:
-
keyrequired, the string key to read fromlocalStorage. The value must match the exact local storage key name used by the application or setup step;
Note: The extension returns the stored value as a string. If the key does not exist, localStorage.getItem(key) returns null.
How to apply this to your journey
Use the extension in a journey by calling Browser/localStorageGet with the execute command. Pass the local storage key to the matching extension input using as key.
Note: Run this step after the application has stored the value and while the journey is still on a page from the same origin where that local storage entry is available.
execute "Browser/localStorageGet" using "authcode" as key returning $responseexecute "Browser/localStorageGet" using "featureFlag" as key returning $responseYou can also pass the key from a Virtuoso variable.
execute "Browser/localStorageGet" using "$storageKey" as key returning $responsestore value "authcode" in $storageKey
execute "Browser/localStorageGet" using "$storageKey" as key returning $responseExample output when the key exists:
abc123This extension does not require any external resource.
The extension should be configured as:
- Run asynchronously: No
- Scope: Global
Limitation: This extension reads only the localStorage available to the current document origin where the Virtuoso step executes. Local storage is origin-scoped, so a value saved on one protocol, domain, subdomain, port, iframe, or browser context may not be visible from another. Browser privacy settings, private browsing sessions, blocked storage, sandboxed or cross-origin frames, and mobile or cross-browser execution environments can restrict or clear storage differently. The extension does not parse JSON, validate the returned value, wait for the application to write the key, or distinguish between a missing key and an intentionally stored null-like business value; add journey waits or assertions when the application writes local storage asynchronously.
Add the extension to your Virtuoso instance
Select the domain that matches your Virtuoso account.
View source
Last updated: 04/06/2026
Resources:
This extension does not require any external resource.
// Note this extension is not a product feature of Virtuoso and is not officially supported
// Extensions use javascript which may or may not be compatible with systems under test (SUTs)
// We welcome you to use this extension or adapt it for your needs
// Instructions:
// This extension allows you to retrieve values stored into the local storage using the setLocalStorage extension or that are stored into local storage by the web application itself
// Write a step localStorageGet (key) returning $var
// key in this case will be the key of the data stored in the localStorageSet extension e.g. authcode
let local = localStorage.getItem(key);
return local
Comments
0 comments
Please sign in to leave a comment.