
He has spent the last decade writing about Android, smartphones, and other mobile technology. Justin Duino is the Reviews Director at How-To Geek (and LifeSavvy Media as a whole). Since 2011, Chris has written over 2,000 articles that have been read more than one billion times-and that’s just here at How-To Geek. Chris has written for The New York Times and Reader’s Digest, been interviewed as a technology expert on TV stations like Miami’s NBC 6, and had his work covered by news outlets like the BBC.
He’s written about technology for over a decade and was a PCWorld columnist for two years. This will clear any stored data.Chris Hoffman is Editor-in-Chief of How-To Geek. If both approaches are not feasible, you can alway restart the browser, by closing the old instance and creating a new one. This will instruct the browser to clear the cookies and cache by directly calling Network.clearBrowserCookies and Network.clearBrowserCache. You can directly use functions from the Chrome DevTools Protocol by using a CDPSession.Įxample const client = await page.target().createCDPSession() Īwait nd('Network.clearBrowserCookies') Īwait nd('Network.clearBrowserCache') It has functions which are not implemented in puppeteer to reset cookies and cache.

If you cannot rely on using context (as they are not supported when using extensions), you can use the Chrome DevTools Protocol to clear the history of the browser. Option 2: Use the Chrome DevTools Protocol to clear history To clear any cookies or history inside, simply close the context via context.close(). From there on you can use the page handle like you normally would. This example will create a new incognito browser window and open a page inside. This won't share cookies/cache with other browser contexts.Įxample const context = await browser.createIncognitoBrowserContext() Quote from the docs:Ĭreates a new incognito browser context. You create a context by calling browser.createIncognitoBrowserContext().


To clear the history (including cookies and any data), you can use an "incognito" window called BrowserContext in puppeteer.
