Skip to main content
Version: 24.38.0

CookieParam 接口

🌐 CookieParam interface

用于在页面级 cookies API 中设置 cookies 的 Cookie 参数对象。

🌐 Cookie parameter object used to set cookies in the page-level cookies API.

语法

🌐 Signature

export interface CookieParam

属性

🌐 Properties

属性

🌐 Property

修饰符

🌐 Modifiers

类型

🌐 Type

描述

🌐 Description

默认

🌐 Default

domain

optional

string

Cookie 域。

🌐 Cookie domain.

expires

optional

number

Cookie 过期日期,如果未设置会话 cookie

🌐 Cookie expiration date, session cookie if not set

httpOnly

optional

boolean

如果 cookie 仅限 http,则为 True。

🌐 True if cookie is http-only.

name

string

Cookie 名称。

🌐 Cookie name.

partitionKey

optional

[CookiePartitionKey](./puppeteer.cookiepartitionkey.md) |弦

Cookie 分区键。在 Chrome 中,它与分区 cookie 可用的顶层站点匹配。在 Firefox 中,它与 PartitionKey 中的源来源匹配。

🌐 Cookie partition key. In Chrome, it matches the top-level site the partitioned cookie is available in. In Firefox, it matches the source origin in the PartitionKey.

path

optional

string

Cookie 路径。

🌐 Cookie path.

priority

optional

CookiePriority

Cookie 优先级。仅在 Chrome 中支持。

🌐 Cookie Priority. Supported only in Chrome.

sameParty

optional, deprecated

boolean

已弃用:

总是被忽视。

🌐 Always ignored.

sameSite

optional

CookieSameSite

Cookie SameSite 类型。

🌐 Cookie SameSite type.

secure

optional

boolean

如果 cookie 是安全的,则为 True。

🌐 True if cookie is secure.

sourceScheme

optional

CookieSourceScheme

Cookie 源方案类型。仅在 Chrome 中支持。

🌐 Cookie source scheme type. Supported only in Chrome.

url

optional

string

要与 Cookie 设置关联的请求 URI。此值可以影响所创建 Cookie 的默认域、路径和源方案值。

🌐 The request-URI to associate with the setting of the cookie. This value can affect the default domain, path, and source scheme values of the created cookie.

value

string

Cookie 值。

🌐 Cookie value.