> ## Documentation Index
> Fetch the complete documentation index at: https://momentic.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# localStorage

> Write a key/value pair into `window.localStorage`.

Sets the value before the next step runs. Useful for seeding the page with
feature flags, onboarding state, or auth tokens that the app reads from
`localStorage`.

## Parameters

| Parameter | Type      | Required | Description                                                           |
| --------- | --------- | -------- | --------------------------------------------------------------------- |
| `key`     | `string`  | Yes      | `localStorage` key.                                                   |
| `value`   | `string`  | Yes      | `localStorage` value.                                                 |
| `saveAs`  | `string`  | No       | Name of the variable to write this step's return value to.            |
| `retries` | `number`  | No       | Number of times to retry the step on failure before failing the test. |
| `skipped` | `boolean` | No       | Skip this step at execution time.                                     |

## Examples

```yaml theme={null}
- localStorage:
    key: momenticTestKey2
    value: momenticTestValue3
```

```yaml theme={null}
- localStorage:
    key: featureFlags
    value: '{"newCheckout":true}'
```

## Related

* [Test format](/core-concepts/test-format)
