Cookies and storage
BrowserContext owns cookies, localStorage, sessionStorage, and
IndexedDB. Set them before the first navigation and they are present on
page load.
Pre-seed a cookie
Read all cookies
Clear / delete
Pre-seed localStorage
storageState is the most reliable path — JS-injected localStorage
before navigation can fight with the page's own bootstrap.
Then in config:
Read storage state
sessionStorage via init script
storageState only restores cookies and localStorage. For
sessionStorage (or to clear specific keys), use an init script: