Rayrun
← Back to Discord Forum

View local storage

madolla_mikeposted in #help-playwright
Open in Discord
madolla_mike
madolla_mike

I'm migrating from Cypress, and have grown accustomed to being able to open the browser dev tools and view what my app stores in local storage after my tests run. It seems that in Playwright this ability is lost, as the browser (chromium) devtools just show the local storage for Playwright, and not my application. Is there any way to inspect local storage / state within a test in UI mode?

This thread is trying to answer question "Is there any way to inspect local storage or state within a test in UI mode in Playwright?"

6 replies

Hi, i have the same question. How to see my test browser local storage? The one that is made avaiable when inspect the browser from trace viewer is not my test browser local storage

Worse case, might suggest registering an 'afterEach' and log out the localSettings. Might be a better way but assuming you more interested in being able to view it.... I believe that shuld work, even better make it a generic routine to simply say "DumpLocalStorage()" anytime...? Might even add it to the beforeAll() as well? But main thing is being able to view it?

But that is only before each or after each. In cypress, I am able to do f12 and look at application local storage at any given time point of execution. Not such thing in playwright?

So your not interested in what is in local storage? Also which browser instance are you using to look at the storage? PW doesn't use the machine/user browser, might assume cypress does, pros and cons either way.

I don't have it at hand but if i remember correctly i was using console.logs to view what is in session storage when i had to. Not much of a help but better than nothing 🙈

I figured it out. If I use browser instead of trace viewer, I can see my application local storage

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].