Skip to content

Commit

Permalink
docs: improve addCookies.cookie parameter description (#31456)
Browse files Browse the repository at this point in the history
  • Loading branch information
yury-s committed Jun 26, 2024
1 parent 41b185d commit 111876d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
10 changes: 3 additions & 7 deletions docs/src/api/class-browsercontext.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 5 additions & 6 deletions packages/playwright-core/types/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8286,27 +8286,26 @@ 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;

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;

Expand Down

0 comments on commit 111876d

Please sign in to comment.