[BUG] browserContext.cookies([urls]) doesn't work when URLs are specified
See original GitHub issueContext:
- Playwright Version: 1.7.0
- Operating System: macOS 10.15.7
- Node.js version: 12.18.4
- Browser: All
- Extra: None
Code Snippet
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch()
const page = await browser.newPage()
const URL = 'https://google.com.vn/'
await page.goto(URL)
const cookies = await page.context().cookies(URL)
cookies.map((cookie) => console.log(JSON.stringify(cookie)))
await browser.close()
})();
Describe the bug
When the URLs params are specified, this method can not get any cookies that affect those URLs (e.g: https://google.com.vn) while If no URLs are specified, this method returns all cookies of https://google.com.vn
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
BrowserContext | Playwright - CukeTest
If no URLs are specified, this method returns all cookies. If URLs are specified, only cookies that affect those URLs are returned. browserContext.exposeBinding ......
Read more >BrowserContext (Playwright - Main Library 1.12.1 API)
If no URLs are specified, this method returns all cookies. If URLs are specified, only cookies that affect those URLs are returned.
Read more >Why can't I get cookie value in Playwright? - Stack Overflow
The reason the first method seemingly does not work is because it returns the headers of the request and responses made. Cookies can...
Read more >Playwright setCookie - CodeceptJS Community
I.setCookie({cookie}) . I have an error: browserContext.addCookies: Cookie should have a url or a domain/path pair at Connection.
Read more >Safari Technology Preview Release Notes - Apple Developer
Changed URL breakpoints to also pause when an HTML attribute is set that ... Fixed "no-cache" network error (r286655); Fixed same-site lax cookies...
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 FreeTop 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
Top GitHub Comments
I’ve tried with
Playwright@next
but it seems to be unstable between browsers. When I usedwebkit
, the returned cookies is consistent betweenawait page.context().cookies()
andawait page.context().cookies([urls])
. But when I usedchromium
and specifiedurls
like below lines of codeI just got 1 cookie instead of 2.
Thanks for your information.