Puppeteer: At least one of the url and domain needs to be specified
A cookie lacks both a URL and a domain for its target.
A cookie lacks both a URL and a domain for its target.
Error message
At least one of the url and domain needs to be specified
How this error happens
A cookie operation needs a domain or an HTTP(S) URL from which a domain can be derived. On a blank BiDi page, neither can be inferred.
The snippets use a new WebDriver BiDi page named page.
await page.setCookie({
name: "session",
value: "example",
});
How to fix
Supply the site’s URL or domain explicitly.
await page.setCookie({
name: "session",
value: "example",
url: "https://example.com",
});
Things to keep in mind
Cookie deletion also needs a target. A domain and a URL describe cookie scope; they are not interchangeable with an arbitrary file path or selector.