Skip to main content

Storage · SetStorage · ClearStorage

This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET

Save, restore or clear the current WebView's storage state: its cookies and its origin's localStorage and sessionStorage, in the shape Vibium saves — {cookies, origins: [{origin, localStorage, sessionStorage}]} — so a state saved by one restores in the other. These call app_storage.

Storage​

public IDictionary<string, object?> Storage()

The current page's storage state, in the shape Vibium saves: cookies, and origins with origin, localStorage and sessionStorage.

SetStorage​

public void SetStorage(IDictionary<string, object?> state)

Restores a saved state: its cookies, and each origin's storage into the page only if the page is on that origin.

ClearStorage​

public void ClearStorage()

Empties the current page's cookies, localStorage and sessionStorage.

Examples​

Save the WebView's cookies and web storage​

var state = device.Storage(); // cookies and origins

The same call from the command line, mobium storage -o state.json, printed on an Android 15 emulator:

saved state.json

mobium storage -o state.json on an Android 15 emulator

mobium storage -o state.json on an Android 15 emulator

Restore them in a later run​

device.SetStorage(new Dictionary<string, object?>
{
["cookies"] = new List<object?>(),
["origins"] = new List<object?>(),
});

The same call from the command line, mobium storage restore state.json, printed on an Android 15 emulator:

restored 1 cookie(s) and https://mobiumapp.test's storage
{
"cookies": [
{
"name": "visited",
"value": "yes",
"domain": "mobiumapp.test",
"path": "/",
"expires": 1790759538.232578,
"secure": true
}
],
"origins": [
{
"origin": "https://mobiumapp.test",
"localStorage": [
{
"name": "visits",
"value": "2"
}
],
"sessionStorage": [
{
"name": "lastVisit",
"value": "visit 2"
}
]
}
]
}
BeforeAfter
Before: mobium storage restore state.json on an Android 15 emulatorAfter: mobium storage restore state.json on an Android 15 emulator

mobium storage restore state.json on an Android 15 emulator