Home Reference Source
public class | since chrome-remote-interface-extra | source

Cookie

An abstraction around using the CDP and Cookies

Static Method Summary

Static Public Methods
public static

fromString(cookieString: string, networkManager: NetworkManager, additionalProps: Object): Cookie

Creates a new Cookie from the supplied string

Constructor Summary

Public Constructor
public

constructor(cookie: CDPCookie, networkManager: NetworkManager)

Member Summary

Private Members
private
private

Method Summary

Public Methods
public

deleteCookie(forURL: string): Promise<void>

Deletes this browser cookie by matching name and url or domain/path pair

public

Cookie domain

public

Cookie expiration date as the number of seconds since the UNIX epox

public

True if the cookie is http-only

public

async modifyCookie(modifications: CookieParam): Promise<boolean>

Modifies this cookie with the given cookie data; may overwrite equivalent cookies if they exist

public

Cookie name

public

Cookie path

public

Represents the cookie's 'SameSite' status: https://tools.ietf.org/html/draft-west-first-party-cookies One of: Strict, Lax

public

True if the cookie is secure (HTTPS)

public

True in case of session cookie

public
public

The size of the cookie

public
public

Cookie value

Static Public Methods

public static fromString(cookieString: string, networkManager: NetworkManager, additionalProps: Object): Cookie source

Creates a new Cookie from the supplied string

Params:

NameTypeAttributeDescription
cookieString string
  • nullable: false

String representation of a cookie 'name=value'

networkManager NetworkManager
  • nullable: false
additionalProps Object
  • optional

Additional values for the cookie if any

Return:

Cookie

Public Constructors

public constructor(cookie: CDPCookie, networkManager: NetworkManager) source

Params:

NameTypeAttributeDescription
cookie CDPCookie
  • nullable: false
networkManager NetworkManager
  • nullable: false

Private Members

private _networkManager: NetworkManager source

Public Methods

public deleteCookie(forURL: string): Promise<void> source

Deletes this browser cookie by matching name and url or domain/path pair

Params:

NameTypeAttributeDescription
forURL string
  • optional

Return:

Promise<void>

See:

public domain(): string source

Cookie domain

Return:

string

public expires(): number source

Cookie expiration date as the number of seconds since the UNIX epox

Return:

number

public httpOnly(): boolean source

True if the cookie is http-only

Return:

boolean

public async modifyCookie(modifications: CookieParam): Promise<boolean> source

Modifies this cookie with the given cookie data; may overwrite equivalent cookies if they exist

Params:

NameTypeAttributeDescription
modifications CookieParam
  • nullable: false

Return:

Promise<boolean>

public name(): string source

Cookie name

Return:

string

public path(): string source

Cookie path

Return:

string

public sameSite(): string source

Represents the cookie's 'SameSite' status: https://tools.ietf.org/html/draft-west-first-party-cookies One of: Strict, Lax

Return:

string (nullable: true)

public secure(): boolean source

True if the cookie is secure (HTTPS)

Return:

boolean

public session(): boolean source

True in case of session cookie

Return:

boolean

public setCookie(): Promise<boolean> source

Return:

Promise<boolean>

public size(): number source

The size of the cookie

Return:

number

public toJSON(): CDPCookie source

Return:

CDPCookie

public value(): string source

Cookie value

Return:

string