Debugging Playwright CDP Sessions That Lose Cookies and Proxy Context
The article discusses debugging issues with Playwright CDP sessions that lose cookies and proxy context. It emphasizes the importance of verifying the browser identity before troubleshooting session-related problems. The author outlines common symptoms and persistence models that can lead to confusion during debugging.
- ▪Playwright scripts may behave as if the session is empty despite a successful connection to the browser.
- ▪Common symptoms include empty cookies, unexpected redirects to login, and mismatched public IP addresses.
- ▪The article highlights three persistence models: storageState, launchPersistentContext, and connectOverCDP, which should not be mixed.
Opening excerpt (first ~120 words) tap to expand
try { if(localStorage) { let currentUser = localStorage.getItem('current_user'); if (currentUser) { currentUser = JSON.parse(currentUser); if (currentUser.id === 3957975) { document.getElementById('article-show-container').classList.add('current-user-is-article-author'); } } } } catch (e) { console.error(e); } ZP Posted on May 30 Debugging Playwright CDP Sessions That Lose Cookies and Proxy Context #playwright #automation #ai #webdev I started treating this as a separate bug class after seeing the same failure pattern repeat: A human opens a browser profile and is logged in. A Playwright script attaches through CDP. The page opens. Then the workflow behaves as if the session is empty, the account is logged out, or the request is coming from the wrong proxy.
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at DEV.to (Top).