Skip to main content
Version: 23.10.1

Page.setCookie() 方法

¥Page.setCookie() method

警告:此 API 现已过时。

¥Warning: This API is now obsolete.

页面级 cookie API 已弃用。改用 Browser.setCookie()BrowserContext.setCookie()

¥Page-level cookie API is deprecated. Use Browser.setCookie() or BrowserContext.setCookie() instead.

签名

¥Signature

class Page {
abstract setCookie(...cookies: CookieParam[]): Promise<void>;
}

参数

¥Parameters

范围

类型

描述

cookies

CookieParam[]

Returns:

Promise<void>

示例

¥Example

await page.setCookie(cookieObject1, cookieObject2);