Skip to content

CoreAgent

Namespace: E2E

public sealed class CoreAgent

An agent over one session, configured in code: ActAsync, AssertAsync, WaitForAsync, and ExtractAsync behave as they do in a test. With a cache, ActAsync replays recorded flows, each keyed by the CacheKey the call names. Upstream’s CachingAgent, CoreAgent, and UncheckedAgent (core/agent.ts), which TypeScript tells apart by the options createAgent was called with: C# has one type, and refuses at runtime the ActAsync call that does not fit the agent.

Inheritance: object

View source

ActAsync(string, CachingActOptions?, CancellationToken)

Section titled “ActAsync(string, CachingActOptions?, CancellationToken)”
public Task<ActResult> ActAsync(string instruction, CachingActOptions? options = null, CancellationToken cancellationToken = default)

Runs one goal. On an agent with a cache the call names its recording with CacheKey, or runs live with Cache set to false; without one it fails with INVALID_ARGUMENT. On an agent without a cache, naming either fails with INVALID_ARGUMENT.

Parameters

Name Type Description
instruction string
options CachingActOptions
cancellationToken CancellationToken

Returns: Task<ActResult>

AssertAsync(string, AssertOptions?, CancellationToken)

Section titled “AssertAsync(string, AssertOptions?, CancellationToken)”
public Task AssertAsync(string statement, AssertOptions? options = null, CancellationToken cancellationToken = default)

Checks that the statement holds on the current screen. See AssertAsync.

Parameters

Name Type Description
statement string
options AssertOptions
cancellationToken CancellationToken

Returns: Task

ExtractAsync<T>(string, ExtractOptions?, CancellationToken)

Section titled “ExtractAsync<T>(string, ExtractOptions?, CancellationToken)”
public Task<T> ExtractAsync<T>(string instruction, ExtractOptions? options = null, CancellationToken cancellationToken = default)

Reads data off the current screen. See ExtractAsync&lt;T&gt;.

Type parameters

Name Description
T

Parameters

Name Type Description
instruction string
options ExtractOptions
cancellationToken CancellationToken

Returns: Task<T>

WaitForAsync(string, WaitForOptions?, CancellationToken)

Section titled “WaitForAsync(string, WaitForOptions?, CancellationToken)”
public Task WaitForAsync(string statement, WaitForOptions? options = null, CancellationToken cancellationToken = default)

Waits until the statement holds on screen. See WaitForAsync.

Parameters

Name Type Description
statement string
options WaitForOptions
cancellationToken CancellationToken

Returns: Task