Skip to main content
Version: 24.38.0

Page.cookies() 方法

🌐 Page.cookies() method

警告:此 API 现已过时。

页面级别的 cookie API 已被弃用。请改用 Browser.cookies()BrowserContext.cookies()

如果未指定 URL,此方法将返回当前页面 URL 的 Cookie。如果指定了 URL,则仅返回这些 URL 的 Cookie。

🌐 If no URLs are specified, this method returns cookies for the current page URL. If URLs are specified, only cookies for those URLs are returned.

语法

🌐 Signature

class Page {
abstract cookies(...urls: string[]): Promise<Cookie[]>;
}

参数

🌐 Parameters

范围

🌐 Parameter

类型

🌐 Type

描述

🌐 Description

urls

string[]

返回:

Promise<Cookie[]>