You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been testing cookieContainer across various websites in multiple scenarios, and in my experience, it's highly unreliable. The results from the getCookies() method consistently differ from the actual cookies present after visiting a page in a real browser.
index.ts
import{Browser}from"happy-dom";constbrowser=newBrowser();constpage=browser.newPage();try{consturl="https://www.example.com/";console.log(`Navigating to ${url}...`);awaitpage.goto(url);constcookies=awaitpage.context.cookieContainer.getCookies(newURL(url));console.log("\n--- Cookies ---");console.log(JSON.stringify(cookies,null,2));console.log("---------------");}catch(error){console.error("Error occurred:",error);}finally{console.log("\nClosing browser...");awaitbrowser.close();console.log("Browser closed.");}
Uh oh!
There was an error while loading. Please reload this page.
I've been testing
cookieContainer
across various websites in multiple scenarios, and in my experience, it's highly unreliable. The results from thegetCookies()
method consistently differ from the actual cookies present after visiting a page in a real browser.index.ts
First run
Second run
Real browser cookies
The text was updated successfully, but these errors were encountered: