Table of Contents

Class EvaluateResult

Namespace
WebDriverBiDi.Script
Assembly
WebDriverBiDi.dll

Base class for the result of a script evaluation.

[JsonConverter(typeof(DiscriminatedUnionJsonConverter<EvaluateResult>))]
[DiscriminatedTypeProperty("type")]
[DiscriminatedDerivedType(typeof(EvaluateResultSuccess), "success")]
[DiscriminatedDerivedType(typeof(EvaluateResultException), "exception")]
public record EvaluateResult : CommandResult, IEquatable<CommandResult>, IEquatable<EvaluateResult>
Inheritance
EvaluateResult
Implements
Derived
Inherited Members

Constructors

EvaluateResult()

Initializes a new instance of the EvaluateResult class.

protected EvaluateResult()

EvaluateResult(EvaluateResult)

protected EvaluateResult(EvaluateResult original)

Parameters

original EvaluateResult

Properties

EqualityContract

protected override Type EqualityContract { get; }

Property Value

Type

RealmId

Gets the ID of the realm in which the script was executed.

[JsonPropertyName("realm")]
[JsonRequired]
[JsonInclude]
public string RealmId { get; }

Property Value

string

ResultType

Gets the type of the result of the script execution.

[JsonPropertyName("type")]
[JsonRequired]
[JsonInclude]
public EvaluateResultType ResultType { get; }

Property Value

EvaluateResultType

Methods

As<T>()

Casts this EvaluateResult to a type-specific evaluation result, throwing if it is not of that type. Use TryAs<T>(out T?) to test without throwing.

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

Returns

T

This instance cast to the specified correct type.

Type Parameters

T

The specific type of EvaluateResult to return.

Exceptions

WebDriverBiDiException

Thrown if this EvaluateResult is not the specified type.

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

Equals(CommandResult?)

public override sealed bool Equals(CommandResult? other)

Parameters

other CommandResult

Returns

bool

Equals(EvaluateResult?)

public virtual bool Equals(EvaluateResult? other)

Parameters

other EvaluateResult

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

PrintMembers(StringBuilder)

protected override bool PrintMembers(StringBuilder builder)

Parameters

builder StringBuilder

Returns

bool

ToString()

public override string ToString()

Returns

string

TryAs<T>(out T?)

Attempts to cast this EvaluateResult to a type-specific evaluation result, returning false rather than throwing when it is not of that type.

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

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 specific type of EvaluateResult to return.

Operators

operator ==(EvaluateResult?, EvaluateResult?)

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

Parameters

left EvaluateResult
right EvaluateResult

Returns

bool

operator !=(EvaluateResult?, EvaluateResult?)

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

Parameters

left EvaluateResult
right EvaluateResult

Returns

bool