Table of Contents

Class RemoteValue

Namespace
WebDriverBiDi.Script
Assembly
WebDriverBiDi.dll

Object representing a remote value in the browser.

[JsonConverter(typeof(DiscriminatedUnionJsonConverter<RemoteValue>))]
[DiscriminatedTypeProperty("type", UnmatchedValueType = typeof(ObjectReferenceRemoteValue))]
[DiscriminatedDerivedType(typeof(NullRemoteValue), "null")]
[DiscriminatedDerivedType(typeof(UndefinedRemoteValue), "undefined")]
[DiscriminatedDerivedType(typeof(StringRemoteValue), "string")]
[DiscriminatedDerivedType(typeof(NumberRemoteValue), "number")]
[DiscriminatedDerivedType(typeof(BooleanRemoteValue), "boolean")]
[DiscriminatedDerivedType(typeof(BigIntegerRemoteValue), "bigint")]
[DiscriminatedDerivedType(typeof(DateRemoteValue), "date")]
[DiscriminatedDerivedType(typeof(RegExpRemoteValue), "regexp")]
[DiscriminatedDerivedType(typeof(NodeRemoteValue), "node")]
[DiscriminatedDerivedType(typeof(WindowProxyRemoteValue), "window")]
[DiscriminatedDerivedType(typeof(CollectionRemoteValue), "array")]
[DiscriminatedDerivedType(typeof(CollectionRemoteValue), "set")]
[DiscriminatedDerivedType(typeof(CollectionRemoteValue), "nodelist")]
[DiscriminatedDerivedType(typeof(CollectionRemoteValue), "htmlcollection")]
[DiscriminatedDerivedType(typeof(KeyValuePairCollectionRemoteValue), "object")]
[DiscriminatedDerivedType(typeof(KeyValuePairCollectionRemoteValue), "map")]
public abstract record RemoteValue : IEquatable<RemoteValue>
Inheritance
RemoteValue
Implements
Derived
Inherited Members

Constructors

RemoteValue(RemoteValue)

protected RemoteValue(RemoteValue original)

Parameters

original RemoteValue

Properties

EqualityContract

protected virtual Type EqualityContract { get; }

Property Value

Type

Type

Gets the type of this RemoteValue.

[JsonPropertyName("type")]
[JsonInclude]
public virtual RemoteValueType Type { get; }

Property Value

RemoteValueType

Methods

As<T>()

Casts this RemoteValue to the specified type-specific RemoteValue type, throwing if it is not of that type. Use TryAs<T>(out T?) to test without throwing.

public T As<T>() where T : RemoteValue

Returns

T

This RemoteValue, cast to the specified type-specific RemoteValue type.

Type Parameters

T

The type-specific RemoteValue type to cast to.

Exceptions

WebDriverBiDiException

Thrown if this RemoteValue cannot be cast to the specified type.

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

Equals(RemoteValue?)

public virtual bool Equals(RemoteValue? other)

Parameters

other RemoteValue

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

PrintMembers(StringBuilder)

protected virtual bool PrintMembers(StringBuilder builder)

Parameters

builder StringBuilder

Returns

bool

ToLocalValue()

Converts this RemoteValue to a LocalValue for use with sending to the protocol remote end.

public abstract LocalValue ToLocalValue()

Returns

LocalValue

A LocalValue representing the this RemoteValue value.

ToString()

public override string ToString()

Returns

string

TryAs<T>(out T?)

Attempts to cast this RemoteValue to the specified type-specific RemoteValue type, returning false rather than throwing when it is not of that type.

public bool TryAs<T>(out T? result) where T : RemoteValue

Parameters

result T

When this method returns, contains the cast value or null if the cast failed.

Returns

bool

true if the cast was successful; otherwise, false.

Type Parameters

T

The type-specific RemoteValue type to cast to.

Operators

operator ==(RemoteValue?, RemoteValue?)

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

Parameters

left RemoteValue
right RemoteValue

Returns

bool

operator !=(RemoteValue?, RemoteValue?)

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

Parameters

left RemoteValue
right RemoteValue

Returns

bool