Google Puppeteer not fetching all third-party cookies

1.6k Views Asked by At
Network.getAllCookies

# Returns all browser cookies. Depending on the backend support, will return detailed cookie information in the cookies field.

RETURN OBJECT
cookies

array Cookie
Array of cookie objects.

enter image description here

Chrome Dev tool Guide

    (async() => {
      const browser = await puppeteer.launch({});
      const page = await browser.newPage();
      await page.goto('https://stack.com', {waitUntil : 'networkidle2' });
      // tried params like this as well
      // {waitUntil: 'load', timeout: 0}
      // {waitUntil: 'networkidle0', timeout: 0}
      // {waitUntil: 'domContentLoaded', timeout: 0}

      // Here we can get all of the cookies
      console.log(await page._client.send('Network.getAllCookies'));

    })();

Not returning all cookies - Any other function to get cookies set by third-party scripts in the site.?

1

There are 1 best solutions below

0
Reece Daniels On

If you're on macOs you can use the NPM package chrome-cookies-secure to pull them from your hard-disk. (https://www.npmjs.com/package/chrome-cookies-secure)

My related answer on a different post (https://stackoverflow.com/a/55630524/10732370).