Table of Contents

Class LocalValue

Namespace
WebDriverBiDi.Script
Assembly
WebDriverBiDi.dll

Object representing a local value for use as an argument in script execution.

[JsonDerivedType(typeof(LocalArgumentValue))]
[JsonDerivedType(typeof(RemoteReference))]
[JsonDerivedType(typeof(RemoteObjectReference))]
[JsonDerivedType(typeof(SharedReference))]
[JsonDerivedType(typeof(ChannelValue))]
public record LocalValue : IEquatable<LocalValue>
Inheritance
LocalValue
Implements
Derived
Inherited Members

Constructors

LocalValue()

Initializes a new instance of the LocalValue class. This constructor is protected to prevent instantiation by other consumers.

protected LocalValue()

LocalValue(LocalValue)

protected LocalValue(LocalValue original)

Parameters

original LocalValue

Properties

EqualityContract

protected virtual Type EqualityContract { get; }

Property Value

Type

Infinity

Gets a LocalValue for positive infinity.

public static LocalValue Infinity { get; }

Property Value

LocalValue

NaN

Gets a LocalValue for "NaN".

public static LocalValue NaN { get; }

Property Value

LocalValue

NegativeInfinity

Gets a LocalValue for negative infinity.

public static LocalValue NegativeInfinity { get; }

Property Value

LocalValue

NegativeZero

Gets a LocalValue for negative zero (-0).

public static LocalValue NegativeZero { get; }

Property Value

LocalValue

Null

Gets a LocalValue for a null value.

public static LocalValue Null { get; }

Property Value

LocalValue

Undefined

Gets a LocalValue for "undefined".

public static LocalValue Undefined { get; }

Property Value

LocalValue

Methods

Array(List<LocalValue>)

Creates a LocalValue for an array.

public static LocalValue Array(List<LocalValue> arrayValue)

Parameters

arrayValue List<LocalValue>

The list of LocalValues to wrap as an array LocalValue.

Returns

LocalValue

A LocalValue for an array.

BigInt(BigInteger)

Creates a LocalValue for a BigInteger.

public static LocalValue BigInt(BigInteger bigIntValue)

Parameters

bigIntValue BigInteger

The BigInteger to wrap as a LocalValue.

Returns

LocalValue

A LocalValue for a BigInteger.

Boolean(bool)

Creates a LocalValue for a boolean value.

public static LocalValue Boolean(bool boolValue)

Parameters

boolValue bool

The boolean to wrap as a LocalValue.

Returns

LocalValue

A LocalValue for a boolean value.

Date(DateTime)

Creates a LocalValue for a DateTime value.

public static LocalValue Date(DateTime dateTimeValue)

Parameters

dateTimeValue DateTime

The DateTime value to wrap as a LocalValue.

Returns

LocalValue

A LocalValue for a DateTime value.

Remarks

The value is serialized as a UTC date-time string: a DateTime with Local is converted to UTC, and one with Unspecified is treated as local time and likewise converted.

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

Equals(LocalValue?)

public virtual bool Equals(LocalValue? other)

Parameters

other LocalValue

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

Map(Dictionary<object, LocalValue>)

Creates a LocalValue for a map with keys that may be either strings or LocalValues.

public static LocalValue Map(Dictionary<object, LocalValue> mapValue)

Parameters

mapValue Dictionary<object, LocalValue>

The dictionary with strings or LocalValues for keys and LocalValues for values to wrap as a map LocalValue.

Returns

LocalValue

A LocalValue for a map.

Exceptions

WebDriverBiDiException

Thrown when any of the keys of the provided dictionary is neither a string nor a LocalValue.

Map(Dictionary<string, LocalValue>)

Creates a LocalValue for a map with string keys.

public static LocalValue Map(Dictionary<string, LocalValue> mapValue)

Parameters

mapValue Dictionary<string, LocalValue>

The dictionary with strings for keys and LocalValues for values to wrap as a map LocalValue.

Returns

LocalValue

A LocalValue for a map.

Map(Dictionary<LocalValue, LocalValue>)

Creates a LocalValue for a map with LocalValue keys.

public static LocalValue Map(Dictionary<LocalValue, LocalValue> mapValue)

Parameters

mapValue Dictionary<LocalValue, LocalValue>

The dictionary with LocalValues for keys and LocalValues for values to wrap as a map LocalValue.

Returns

LocalValue

A LocalValue for a map.

Number(decimal)

Creates a LocalValue for a number.

public static LocalValue Number(decimal numericValue)

Parameters

numericValue decimal

The decimal to wrap as a LocalValue.

Returns

LocalValue

A LocalValue for a number.

Number(double)

Creates a LocalValue for a number.

public static LocalValue Number(double numericValue)

Parameters

numericValue double

The double to wrap as a LocalValue.

Returns

LocalValue

A LocalValue for a number.

Number(int)

Creates a LocalValue for a number.

public static LocalValue Number(int numericValue)

Parameters

numericValue int

The integer to wrap as a LocalValue.

Returns

LocalValue

A LocalValue for a number.

Number(long)

Creates a LocalValue for a number.

public static LocalValue Number(long numericValue)

Parameters

numericValue long

The long to wrap as a LocalValue.

Returns

LocalValue

A LocalValue for a number.

Remarks

JavaScript numbers are doubles, so a value whose magnitude exceeds 2^53 - 1 cannot be represented exactly and reaches the remote end rounded. Use BigInt(BigInteger) to send such a value exactly.

Object(Dictionary<object, LocalValue>)

Creates a LocalValue for an object with keys that may be either strings or LocalValues.

public static LocalValue Object(Dictionary<object, LocalValue> mapValue)

Parameters

mapValue Dictionary<object, LocalValue>

The dictionary with strings or LocalValues for keys and LocalValues for values to wrap as an object LocalValue.

Returns

LocalValue

A LocalValue for an object.

Exceptions

WebDriverBiDiException

Thrown when any of the keys of the provided dictionary is neither a string nor a LocalValue.

Object(Dictionary<string, LocalValue>)

Creates a LocalValue for an object with string keys.

public static LocalValue Object(Dictionary<string, LocalValue> mapValue)

Parameters

mapValue Dictionary<string, LocalValue>

The dictionary with strings for keys and LocalValues for values to wrap as an object LocalValue.

Returns

LocalValue

A LocalValue for an object.

Object(Dictionary<LocalValue, LocalValue>)

Creates a LocalValue for an object with LocalValue keys.

public static LocalValue Object(Dictionary<LocalValue, LocalValue> mapValue)

Parameters

mapValue Dictionary<LocalValue, LocalValue>

The dictionary with LocalValues for keys and LocalValues for values to wrap as an object LocalValue.

Returns

LocalValue

A LocalValue for an object.

PrintMembers(StringBuilder)

protected virtual bool PrintMembers(StringBuilder builder)

Parameters

builder StringBuilder

Returns

bool

RegExp(string, string?)

Creates a LocalValue for a regular expression.

public static LocalValue RegExp(string pattern, string? flags = null)

Parameters

pattern string

The pattern for the regular expression.

flags string

The flags of the regular expression.

Returns

LocalValue

A LocalValue for a regular expression.

Set(List<LocalValue>)

Creates a LocalValue for a set.

public static LocalValue Set(List<LocalValue> arrayValue)

Parameters

arrayValue List<LocalValue>

The list of LocalValues to wrap as a set LocalValue.

Returns

LocalValue

A LocalValue for a set.

String(string)

Creates a LocalValue for a string.

public static LocalValue String(string stringValue)

Parameters

stringValue string

The string to wrap as a LocalValue.

Returns

LocalValue

A LocalValue for a string.

ToString()

public override string ToString()

Returns

string

Operators

operator ==(LocalValue?, LocalValue?)

public static bool operator ==(LocalValue? left, LocalValue? right)

Parameters

left LocalValue
right LocalValue

Returns

bool

operator !=(LocalValue?, LocalValue?)

public static bool operator !=(LocalValue? left, LocalValue? right)

Parameters

left LocalValue
right LocalValue

Returns

bool