---
id: api/commands/getallsessionstorage
title: getAllSessionStorage | Cypress Documentation
description: >-
  Get sessionStorage data for all origins with which the test has interacted in
  Cypress.
section: api
source_path: docs/api/commands/getallsessionstorage.mdx
version: 3cf5b86b3403f604bdf7f3e35025c3bc3865e02c
updated_at: '2026-05-07T17:44:31.931Z'
---
# getAllSessionStorage

Get [`sessionStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage) data for all origins with which the test has interacted.

## Syntax

```
cy.getAllSessionStorage()cy.getAllSessionStorage(options)
```

### Usage

**Correct Usage**

```
cy.getAllSessionStorage()
```

### Arguments

**options _(Object)_**

Pass in an options object to change the default behavior of `cy.getAllSessionStorage()`.

| Option | Default | Description |
| --- | --- | --- |
| `log` | `true` | Displays the command in the [Command log](/llm/markdown/app/core-concepts/open-mode.md#Command-Log) |

### Yields [Learn about subject management](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Subject-Management)

`cy.getAllSessionStorage()` yields an object where the keys are origins and the values are key-value pairs of `sessionStorage` data.

For example, if `key1` is set to `value1` on `https://example.cypress.io` and `key2` is set to `value2` on `https://www.cypress-dx.com`, `cy.getAllSessionStorage()` will yield:

```
{  'https://example.cypress.io': {    key1: 'value1',  },  'https://www.cypress-dx.com': {    key2: 'value2',  },}
```

## Examples

### Get all sessionStorage

```
cy.visit('/users', {  onBeforeLoad(win) {    win.sessionStorage.setItem('key', 'value')  },})cy.getAllSessionStorage().then((result) => {  expect(result).to.deep.equal({    'http://localhost:8080': {      key: 'value',    },  })})
```

## Rules

### Requirements [Learn about chaining commands](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Chains-of-Commands)

*   `cy.getAllSessionStorage()` requires being chained off of `cy`.

### Assertions [Learn about assertions](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Assertions)

*   `cy.getAllSessionStorage()` will only run assertions you have chained once, and will not [retry](/llm/markdown/app/core-concepts/retry-ability.md).

### Timeouts [Learn about timeouts](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Timeouts)

*   `cy.getAllSessionStorage()` cannot time out.

## See also

*   [`cy.clearAllLocalStorage()`](/llm/markdown/api/commands/clearalllocalstorage.md)
*   [`cy.clearAllSessionStorage()`](/llm/markdown/api/commands/clearallsessionstorage.md)
*   [`cy.clearCookies()`](/llm/markdown/api/commands/clearcookies.md)
*   [`cy.clearLocalStorage()`](/llm/markdown/api/commands/clearlocalstorage.md)
*   [`cy.getAllLocalStorage()`](/llm/markdown/api/commands/getalllocalstorage.md)
