question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature] Browser context serialization to support local storage

See original GitHub issue

The browserContext.cookies and browserContext.setCookies methods make it possible for users to serialize cookies and load them into a new context. This enables loading a new context with authentication state before running tests.

Some apps use local storage to maintain their authentication state, and we should have similar methods for local storage.

Additionally, it might be worth evaluating whether we want to create a higher-level abstraction (“browser context state” maybe?) that covers all such storage (cookies, local storage, indexed db, etc). That way, users will not need to know which storage type they want to serialize and load over. In many cases, users are building applications where authentication is third-party (SSO etc) and therefore knowing which state type is used by auth is not possible.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:10
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
jperlcommented, Mar 7, 2020

We built a saveState and setState in playwright-utils for cookies, localStorage, sessionStorage, not indexed db yet

1reaction
arjunattamcommented, Sep 11, 2020

We now have a guide for sharing authentication state across browser contexts (using APIs for cookies and local storage). We could evolve this into a unified API for all “browser context state” based on user feedback. Please share your user scenarios and help us identify what’s missing 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Persist add-in state and settings - Office Add-ins
Learn to persist data in Office Add-in web applications running in the stateless environment of a browser control.
Read more >
Browser Storage Options and Their State in 2021
1. Local Storage ... Local Storage is the most widely used Storage due to its simplicity. It allows storing key-value pairs serialized as...
Read more >
Please Stop Using Local Storage - DEV Community ‍ ‍
Let's start with the basics: local storage is a new feature of HTML5 that basically allows you (a web developer) to store any...
Read more >
Please Stop Using Local Storage - Randall Degges
Local storage wasn't designed to be used as a secure storage mechanism in a browser. It was designed to be a simple string...
Read more >
chrome.storage - Chrome Developers
The Storage API provides an extension-specific way to persist user data and state. It's similar to the web platform's storage APIs (IndexedDB, and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found