New session and cookies for each new page
See original GitHub issueI am using headless chromium in incognito mode. I need to auth on a website with different account using one single browsers with separate pages simultaniously
async function newPageWithNewContext(browser) {
const { browserContextId } = await browser._connection.send('Target.createBrowserContext');
const { targetId } = await browser._connection.send('Target.createTarget', { url: 'about:blank', browserContextId });
var targetInfo = { targetId: targetId }
const client = await browser._connection.createSession(targetInfo);
const page = await browser.newPage({ context: 'another-context' }, client, browser._ignoreHTTPSErrors, browser._screenshotTaskQueue);
page.browserContextId = browserContextId;
return page;
}
I use this function to create a new page
const page = await newPageWithNewContext(browser);
but pages still share cookies and sessions. How can I turn it off?
Issue Analytics
- State:
- Created 3 years ago
- Comments:12
Top Results From Across the Web
What are session cookies? Do they need consent? - CookieYes
Session cookies are cookies that last only for a single user session. Learn more about why they are used, if they need consent...
Read more >Everything You Need to Know About Session Cookies - Securiti
A session cookie is a simple text file that a website installs on its visitor's device for temporary use. It helps track real-time...
Read more >Develop a webpage for creating session and persistent ...
When a user visits a web page, his/her name can be stored in a cookie. ... 1) Session cookies 2) Persistent cookies ......
Read more >Can I create a new session in another tab or window in ...
Chrome Incognito Mode gives you a new cookie jar, but cookies are shared across other incognito windows. At best, this means you can...
Read more >What are Session Cookies? - AllAboutCookies.org
Webpages have no memories. A user going from page to page will be treated by the website as a completely new visitor. Session...
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

Thank you! It worked!
@abokizh If you want to have independent/incognito page, you have to do following:
If you want another incognito page, you have to repeat these steps -> create another context
This way it works for me, hopefully it will work for you as well.