How to get all cookies?
See original GitHub issueHi yujiosaka,
I’m trying to retrieve all the cookies on a page (1st and third party cookies).
The default result.cookies
only contains 1st party cookies:
onSuccess: (result => {
console.log(result.cookies);
}),
There is a way with Puppeteer to get all cookies, including third party with the await page._client.send('Network.getAllCookies'));
method.
So I’m trying to use that with the crawler, however the onSuccess
method only returns result
which doesn’t contain a reference to Puppeteer’s page
object.
Do you know where I can call the async page._client.send('Network.getAllCookies'));
method so I can retrieve all cookies (1st/third) on every crawled page?
Many thanks
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:8 (3 by maintainers)
Top Results From Across the Web
I need to get all the cookies from the browser - Stack Overflow
To retrieve all cookies for the current document open in the browser, you again use the document.cookie property.
Read more >How to list all the cookies of the current page using JavaScript
Access the cookies using document.cookie. · Use the .split() method to split them on “;” to get an array of cookies. · Traverse...
Read more >cookies.getAll() - Mozilla - MDN Web Docs
The getAll() method of the cookies API retrieves all cookies from a single cookie store that match the given information.
Read more >Clear, enable, and manage cookies in Chrome - Android
Clear all cookies ; To the right of the address bar, tap More More and then Settings. ; Tap Privacy and security and...
Read more >5 Ways to View Cookies - wikiHow
1. Open Google Chrome. It's a green, red, blue, and yellow sphere icon. 2. Click ⋮. This icon is in the top-right corner...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
With
headless-chrome-crawler
version 1.8.0 you can use this customCrawl function to get all cookies:@pandacoder
Actually
page
is exposed through thenewpage
event and from there you could accessbrowser
ortarget
. But as it’s currently exposed it makes it difficult to get/set cookies correctly. I agree thatheadless-chrome-crawler
should be well focused but it needs to be extendable enough to be able to do these kind of things.