Session
Namespace: E2E
public class Session : IAsyncDisposableOne isolated session: a browser context, or the app on a device. Holds Screen, App, Platform, and
Browser. Upstream’s Session and SessionControls (core/launch.ts), over the port’s E2ESession.
Inheritance: object
Implements: IAsyncDisposable
Derived: Session<TFixtures>
Properties
Section titled “Properties”public App App { get; }App lifecycle: open, restart, clear state, back, screenshot, recording.
Value: App
Browser
Section titled “Browser”public Browser Browser { get; }The browser fixture. Its members fail with UNSUPPORTED_CAPABILITY on an engine without a browser.
Value: Browser
Platform
Section titled “Platform”public string Platform { get; }The engine’s platform label: web, ios, android, or an engine’s own string.
Value: string
Screen
Section titled “Screen”public Screen Screen { get; }Semantic queries and the actions on their matches.
Value: Screen
Methods
Section titled “Methods”CloseAsync()
Section titled “CloseAsync()”public Task CloseAsync()Ends the session. Idempotent. Throws an AggregateException of the failures closing found, such as a cleanup that did not finish. Upstream’s close.
Returns: Task
DisposeAsync()
Section titled “DisposeAsync()”public ValueTask DisposeAsync()Ends the session. Idempotent. Throws an AggregateException of the failures closing found, such as a cleanup that did not finish. Upstream’s close.
Returns: ValueTask
SaveStateAsync(CancellationToken)
Section titled “SaveStateAsync(CancellationToken)”public Task<SessionState> SaveStateAsync(CancellationToken cancellationToken = default)Captures the session’s state (cookies, storage, app data) in memory. Persist it only with ExportAsync(SessionStateKeyOptions). Upstream’s saveState.
Parameters
| Name | Type | Description |
|---|---|---|
cancellationToken |
CancellationToken |
Returns: Task<SessionState>
SetDefaultTimeout(TimeSpan)
Section titled “SetDefaultTimeout(TimeSpan)”public void SetDefaultTimeout(TimeSpan timeout)The default timeout of operations started from now on: actions, waits, reads, and app opens and restarts. A running operation keeps the
deadline it started with. Throws INVALID_ARGUMENT unless <code class=“paramref”>timeout</code> is positive and finite. Upstream’s setDefaultTimeout.
Parameters
| Name | Type | Description |
|---|---|---|
timeout |
TimeSpan |