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[]>