Namespace: cookie

cookie

Source:

Methods

(static) add(newCookie, restrictToHostopt)

Insert cookie to the cookie store.

Parameters:
Name Type Attributes Description
newCookie Cookie

Cookie to add.

restrictToHost string <optional>

Perform test that newCookie's domain matches this.

Source:
Throws:
  • If name, value, or domain are not present and of the correct type.

    Type
    TypeError
  • If restrictToHost is set and newCookie's domain does not match.

    Type
    InvalidCookieDomainError
  • If an error occurred while trying to save the cookie.

    Type
    UnableToSetCookieError

(static) fromJSON(json) → {Cookie}

Unmarshal a JSON Object to a cookie representation.

Effectively this will run validation checks on |json|, which will produce the errors expected by WebDriver if the input is not valid.

Parameters:
Name Type Description
json Object.<string, (number|boolean|string)>

Cookie to be deserialised. name and value are required fields which must be strings. The path and domain fields are optional, but must be a string if provided. The secure, and httpOnly are similarly optional, but must be booleans. Likewise, the expiry field is optional but must be unsigned integer.

Source:
Throws:

If any of the properties are invalid.

Type
InvalidArgumentError
Returns:

Valid cookie object.

Type
Cookie

(static) iter(host, currentPathopt) → {Iterable.<Cookie>}

Iterates over the cookies for the current host. You may optionally filter for specific paths on that host by specifying a path in currentPath.

Parameters:
Name Type Attributes Default Description
host string

Hostname to retrieve cookies for.

currentPath string <optional>
"/"

currentPath Optionally filter the cookies for host for the specific path. Defaults to "/", meaning all cookies for host are included.

Source:
Returns:

Iterator.

Type
Iterable.<Cookie>

(static) remove(toDelete)

Remove cookie from the cookie store.

Parameters:
Name Type Description
toDelete Cookie

Cookie to remove.

Source: