Skip to content

WebEngine

Namespace: E2E.Engine

public sealed class WebEngine : IEngine, IAsyncDisposable

Browser engine for the web target. It drives Chromium through Playwright, reads a semantic tree (role, name, text, test id, state), and performs the same node actions the document engine does. Install browsers once with playwright.ps1 install chromium from this project’s build output.

Inheritance: object

Implements: IEngine, IAsyncDisposable

View source

public WebEngine(WebEngineOptions options)

Parameters

Name Type Description
options WebEngineOptions

View source

public WebEngine(bool? headless = null)

Parameters

Name Type Description
headless bool?

View source

public const string EngineVersion = "1.1.0"

Value: string

View source

public EngineCapabilities Capabilities { get; }

Value: EngineCapabilities

View source

public string Platform { get; }

Value: string

View source

public string Version { get; }

Value: string

View source

public ValueTask DisposeAsync()

Worker shutdown: releases the replacement lease the worker acquired for itself, within the cleanup timeout. What prepare leased is the runner’s to release.

Returns: ValueTask

View source

FinishAsync(EngineFinishInfo, CancellationToken)

Section titled “FinishAsync(EngineFinishInfo, CancellationToken)”
public Task FinishAsync(EngineFinishInfo info, CancellationToken cancellationToken)

Releases the browsers CancellationToken) leased, once per run and target, then has the provider sweep up the leases a worker that died left open. Call it after every worker ended, on every exit path, with a cleanup budget in <code class=“paramref”>cancellationToken</code>.

Parameters

Name Type Description
info EngineFinishInfo
cancellationToken CancellationToken

Returns: Task

View source

public void Init(EngineInitInfo info)

Starts the worker of one slot: records the run it serves and, in Worker scope, the lease its slot was handed. Every CancellationToken) after it rides that lease, or a replacement once its browser dropped. It can be called again on a disposed engine.

Parameters

Name Type Description
info EngineInitInfo

View source

PrepareAsync(EnginePrepareInfo, CancellationToken)

Section titled “PrepareAsync(EnginePrepareInfo, CancellationToken)”
public Task<EnginePrepareResult> PrepareAsync(EnginePrepareInfo info, CancellationToken cancellationToken)

Leases one browser per worker slot the run will use from the provider, once per run and target, before any worker starts. The result’s environment is what the workers read in Init(EngineInitInfo). An engine with no provider has nothing to prepare.

Parameters

Name Type Description
info EnginePrepareInfo
cancellationToken CancellationToken

Returns: Task<EnginePrepareResult>

View source

StartAsync(EngineStartOptions, CancellationToken)

Section titled “StartAsync(EngineStartOptions, CancellationToken)”
public Task<IEngineSession> StartAsync(EngineStartOptions options, CancellationToken cancellationToken)

Parameters

Name Type Description
options EngineStartOptions
cancellationToken CancellationToken

Returns: Task<IEngineSession>

View source