From 111876d52619ea662d691f68552ba44ef757224b Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Wed, 26 Jun 2024 15:39:43 -0700 Subject: [PATCH] docs: improve addCookies.cookie parameter description (#31456) --- docs/src/api/class-browsercontext.md | 10 +++------- packages/playwright-core/types/types.d.ts | 11 +++++------ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/docs/src/api/class-browsercontext.md b/docs/src/api/class-browsercontext.md index 686db16f4a7c5..48542a260360d 100644 --- a/docs/src/api/class-browsercontext.md +++ b/docs/src/api/class-browsercontext.md @@ -357,18 +357,14 @@ await context.AddCookiesAsync(new[] { cookie1, cookie2 }); - `cookies` <[Array]<[Object]>> - `name` <[string]> - `value` <[string]> - - `url` ?<[string]> either url or domain / path are required. Optional. - - `domain` ?<[string]> either url or domain / path are required Optional. - - `path` ?<[string]> either url or domain / path are required Optional. + - `url` ?<[string]> Either url or domain / path are required. Optional. + - `domain` ?<[string]> For the cookie to apply to all subdomains as well, prefix domain with a dot, like this: ".example.com". Either url or domain / path are required. Optional. + - `path` ?<[string]> Either url or domain / path are required Optional. - `expires` ?<[float]> Unix time in seconds. Optional. - `httpOnly` ?<[boolean]> Optional. - `secure` ?<[boolean]> Optional. - `sameSite` ?<[SameSiteAttribute]<"Strict"|"Lax"|"None">> Optional. -Adds cookies to the browser context. - -For the cookie to apply to all subdomains as well, prefix domain with a dot, like this: ".example.com". - ## async method: BrowserContext.addInitScript * since: v1.8 diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.ts index 00b20c80c9737..f92eeb71a185e 100644 --- a/packages/playwright-core/types/types.d.ts +++ b/packages/playwright-core/types/types.d.ts @@ -8286,9 +8286,7 @@ export interface BrowserContext { * await browserContext.addCookies([cookieObject1, cookieObject2]); * ``` * - * @param cookies Adds cookies to the browser context. - * - * For the cookie to apply to all subdomains as well, prefix domain with a dot, like this: ".example.com". + * @param cookies */ addCookies(cookies: ReadonlyArray<{ name: string; @@ -8296,17 +8294,18 @@ export interface BrowserContext { value: string; /** - * either url or domain / path are required. Optional. + * Either url or domain / path are required. Optional. */ url?: string; /** - * either url or domain / path are required Optional. + * For the cookie to apply to all subdomains as well, prefix domain with a dot, like this: ".example.com". Either url + * or domain / path are required. Optional. */ domain?: string; /** - * either url or domain / path are required Optional. + * Either url or domain / path are required Optional. */ path?: string;