Puppeteer: Toggle cookies storage

Created on 20 Dec 2017  ·  3Comments  ·  Source: puppeteer/puppeteer

May you add the ability to enable/disable cookies storage on the browser as the configuration in the screenshot below?

image

While scraping, i have to destroy and create a new instance for each website to have them forget everything saved in the cookies storage, eg. the authentication.

Thank you!

Most helpful comment

I know it's not precisely what you ask for. But you don't have to destroy browser instance in order to remove all cookies. You can use dirty way (since we are waiting for #31 ) of sending clearBrowserCookies to raw devtools protocol:

await page._client.send('Network.clearBrowserCookies');

All 3 comments

I know it's not precisely what you ask for. But you don't have to destroy browser instance in order to remove all cookies. You can use dirty way (since we are waiting for #31 ) of sending clearBrowserCookies to raw devtools protocol:

await page._client.send('Network.clearBrowserCookies');

@Everettss Nice! Thank you very much!

The issue was solved, but it would be better for a shortcut function call. 😄

Was this page helpful?
0 / 5 - 0 ratings