Skip to main content

Using Claude Code, Cursor, or another coding agent? Paste this into your prompt to run cross-browser and real-device tests, debug sessions, and wire up CI on the TestMu AI cloud:
localStorage assertions let you verify data stored in the browser’s window.localStorage: check key existence, values, and item counts.

How Capture Works

localStorage is captured as a point-in-time snapshot when the checkpoint triggers:
  • On-demand capture: localStorage is read from the current page at the moment the assertion runs
  • Current state only: You see exactly what’s in localStorage right now
  • Domain-scoped: localStorage is per-origin (protocol + domain + port). You only see data for the current page’s origin
  • String values: All localStorage values are strings. If the application stores JSON objects, they’re stored as JSON strings

Planning for Multi-Step Tests

Because localStorage is captured at assertion time:
  • Assert on localStorage while you’re on the page that set the values. Navigating to a different domain means a different localStorage
  • If values are needed later, extract and store them before navigating away
  • localStorage persists across steps (unlike network/console) as long as you stay on the same origin

JSON Values

Applications often store structured data in localStorage as JSON strings:
In assertions, the value is the raw JSON string. You can parse it to check individual fields:
KaneAI will parse the JSON and drill into the value automatically.

What You Can Query

Example Assertions

Example Extractions

Example If/Else