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
originalLocalValue
Properties
EqualityContract
protected virtual Type EqualityContract { get; }
Property Value
Infinity
Gets a LocalValue for positive infinity.
public static LocalValue Infinity { get; }
Property Value
NaN
Gets a LocalValue for "NaN".
public static LocalValue NaN { get; }
Property Value
NegativeInfinity
Gets a LocalValue for negative infinity.
public static LocalValue NegativeInfinity { get; }
Property Value
NegativeZero
Gets a LocalValue for negative zero (-0).
public static LocalValue NegativeZero { get; }
Property Value
Null
Gets a LocalValue for a null value.
public static LocalValue Null { get; }
Property Value
Undefined
Gets a LocalValue for "undefined".
public static LocalValue Undefined { get; }
Property Value
Methods
Array(List<LocalValue>)
Creates a LocalValue for an array.
public static LocalValue Array(List<LocalValue> arrayValue)
Parameters
arrayValueList<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
bigIntValueBigIntegerThe 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
boolValueboolThe 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
dateTimeValueDateTimeThe 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
objobject
Returns
Equals(LocalValue?)
public virtual bool Equals(LocalValue? other)
Parameters
otherLocalValue
Returns
GetHashCode()
public override int GetHashCode()
Returns
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
mapValueDictionary<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
mapValueDictionary<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
mapValueDictionary<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
numericValuedecimalThe 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
numericValuedoubleThe 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
numericValueintThe 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
numericValuelongThe 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
mapValueDictionary<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
mapValueDictionary<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
mapValueDictionary<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
builderStringBuilder
Returns
RegExp(string, string?)
Creates a LocalValue for a regular expression.
public static LocalValue RegExp(string pattern, string? flags = null)
Parameters
patternstringThe pattern for the regular expression.
flagsstringThe 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
arrayValueList<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
stringValuestringThe string to wrap as a LocalValue.
Returns
- LocalValue
A LocalValue for a string.
ToString()
public override string ToString()
Returns
Operators
operator ==(LocalValue?, LocalValue?)
public static bool operator ==(LocalValue? left, LocalValue? right)
Parameters
leftLocalValuerightLocalValue
Returns
operator !=(LocalValue?, LocalValue?)
public static bool operator !=(LocalValue? left, LocalValue? right)
Parameters
leftLocalValuerightLocalValue