Docs · API reference · Motus.Abstractions

IJSHandle Interface#

Represents a handle to a JavaScript object in the page.

public interface IJSHandle : System.IAsyncDisposable

Derived
↳ IElementHandle

Implements System.IAsyncDisposable

Methods#

EvaluateAsync<T>(string, object) Method#

Evaluates a JavaScript expression in the context of this handle.

System.Threading.Tasks.Task<T> EvaluateAsync<T>(string expression, object? arg=null);

Type parameters#

T

The expected return type.

Parameters#

expression System.String

The JavaScript expression to evaluate.

arg System.Object

Optional argument to pass to the expression.

Returns#

System.Threading.Tasks.Task<T>
The result of the evaluation.

GetPropertyAsync(string) Method#

Gets a property of the JavaScript object by name.

System.Threading.Tasks.Task<Motus.Abstractions.IJSHandle> GetPropertyAsync(string propertyName);

Parameters#

propertyName System.String

The property name.

Returns#

System.Threading.Tasks.Task<IJSHandle>
A handle to the property value.

JsonValueAsync<T>() Method#

Returns the JSON representation of the object.

System.Threading.Tasks.Task<T> JsonValueAsync<T>();

Type parameters#

T

The expected deserialized type.

Returns#

System.Threading.Tasks.Task<T>
The deserialized JSON value.