Table of Contents

Class PartialCookie

Namespace
WebDriverBiDi.Storage
Assembly
WebDriverBiDi.dll

Object containing data for setting values for cookies.

public class PartialCookie
Inheritance
PartialCookie
Inherited Members

Constructors

PartialCookie(string, BytesValue, string)

Initializes a new instance of the PartialCookie class.

public PartialCookie(string name, BytesValue value, string domain)

Parameters

name string

The name of the cookie to set.

value BytesValue

The value of the cookie to set.

domain string

The domain of the cookie to set.

Properties

AdditionalData

Gets the dictionary containing extra data for the cookie.

[JsonExtensionData]
public Dictionary<string, object?> AdditionalData { get; }

Property Value

Dictionary<string, object>

Remarks

An entry may not reuse the name of a property this type already serializes; doing so would write that name twice in the same JSON object, and a JSON object with a duplicate name has no defined meaning. Sending a command that contains such an entry throws WebDriverBiDiSerializationException rather than emitting the ambiguous payload. Set the typed property instead.

Domain

Gets or sets the domain of the cookie.

[JsonPropertyName("domain")]
public string Domain { get; set; }

Property Value

string

Expires

Gets or sets the expiration time of the cookie.

[JsonIgnore]
public DateTime? Expires { get; set; }

Property Value

DateTime?

Remarks

The protocol expresses the time as whole seconds since the Unix epoch, so a value set here is truncated to the second, and a value that is not UTC is converted to UTC first; setting a value before the epoch throws. MaxValue, the usual way to say "never expires", is therefore stored as the last whole second of 9999, and reads back as that second. The value read is always UTC.

Exceptions

ArgumentOutOfRangeException

Thrown when the value is before the Unix epoch.

HttpOnly

Gets or sets a value indicating whether the cookie is only available via HTTP headers.

[JsonPropertyName("httpOnly")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? HttpOnly { get; set; }

Property Value

bool?

Name

Gets or sets the name of the cookie.

[JsonPropertyName("name")]
public string Name { get; set; }

Property Value

string

Path

Gets or sets the path of the cookie.

[JsonPropertyName("path")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Path { get; set; }

Property Value

string

SameSite

Gets or sets the SameSite policy of the cookie.

[JsonPropertyName("sameSite")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public CookieSameSiteValue? SameSite { get; set; }

Property Value

CookieSameSiteValue?

Secure

Gets or sets a value indicating whether the cookie is secure, delivered via an encrypted connection like HTTPS.

[JsonPropertyName("secure")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? Secure { get; set; }

Property Value

bool?

Value

Gets or sets the value of the cookie.

[JsonPropertyName("value")]
public BytesValue Value { get; set; }

Property Value

BytesValue