🚀 Feature Request
Extend the storageState() method to capture and restore sessionStorage alongside cookies and localStorage.
This would allow us to save and reload the complete browser storage state, including session-specific data.
Example
`// Save storage state including sessionStorage
await page.context().storageState({ path: 'auth-state.json', sessionStorage: true })
// Restore all storage types from saved state
const browser = await chromium.launch();
const context = await browser.newContext({
storageState: 'auth-state.json' // Automatically restores cookies, localStorage, and sessionStorage
});`
Motivation
Many modern web applications store critical authentication tokens, temporary user preferences, or application state in sessionStorage rather than localStorage. Currently, Playwright's storageState() doesn't capture sessionStorage, forcing us to:
- Manually extract and restore sessionStorage using page.evaluate()
- Write custom helper functions to work around this limitation
Adding sessionStorage support would:
- Improve test reliability: Preserve complete browser state between test runs
- Reduce test setup time: Eliminate redundant authentication/initialization steps
- Enhance API consistency: Make storageState() comprehensive for all Web Storage APIs
- Simplify test code: Remove boilerplate for manual sessionStorage management
This feature would be particularly valuable for applications using OAuth flows, SPAs with session-based state management, or any system relying on sessionStorage for functionality.
🚀 Feature Request
Extend the storageState() method to capture and restore sessionStorage alongside cookies and localStorage.
This would allow us to save and reload the complete browser storage state, including session-specific data.
Example
`// Save storage state including sessionStorage
await page.context().storageState({ path: 'auth-state.json', sessionStorage: true })
// Restore all storage types from saved state
const browser = await chromium.launch();
const context = await browser.newContext({
storageState: 'auth-state.json' // Automatically restores cookies, localStorage, and sessionStorage
});`
Motivation
Many modern web applications store critical authentication tokens, temporary user preferences, or application state in sessionStorage rather than localStorage. Currently, Playwright's storageState() doesn't capture sessionStorage, forcing us to:
Adding sessionStorage support would:
This feature would be particularly valuable for applications using OAuth flows, SPAs with session-based state management, or any system relying on sessionStorage for functionality.