Table of Contents

Class SessionModule

Namespace
WebDriverBiDi.Session
Assembly
WebDriverBiDi.dll

The Session module contains commands for monitoring the status of the remote end, for creating and ending a session, and for managing event subscriptions. The specification defines no events for this module.

public sealed class SessionModule : Module
Inheritance
SessionModule
Inherited Members

Constructors

SessionModule(IBiDiModuleHost)

Initializes a new instance of the SessionModule class.

public SessionModule(IBiDiModuleHost driver)

Parameters

driver IBiDiModuleHost

The IBiDiModuleHost used in the module commands and events.

Fields

SessionModuleName

The name of the session module.

public const string SessionModuleName = "session"

Field Value

string

Properties

ModuleName

Gets the module name.

public override string ModuleName { get; }

Property Value

string

Methods

EndAsync(EndCommandParameters?, TimeSpan?, CancellationToken)

Ends the current session.

public Task<EndCommandResult> EndAsync(EndCommandParameters? commandParameters = null, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)

Parameters

commandParameters EndCommandParameters

The parameters for the command. If omitted, or if null, the command is sent with default parameters.

timeoutOverride TimeSpan?

The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.

cancellationToken CancellationToken

A cancellation token used to propagate notification that the operation should be canceled. Omitting this argument is the equivalent of using None.

Returns

Task<EndCommandResult>

An empty command result.

Exceptions

ArgumentOutOfRangeException

Thrown when timeoutOverride is negative (other than InfiniteTimeSpan) or exceeds the maximum supported timer duration.

WebDriverBiDiCommandException

Thrown when the remote end returns an error response for the command.

WebDriverBiDiSerializationException

Thrown when the command parameters cannot be serialized, or the response cannot be deserialized.

WebDriverBiDiTimeoutException

Thrown when the command does not complete within the timeout.

WebDriverBiDiConnectionException

Thrown when the driver is not connected to a remote end, or the connection is lost before the command completes.

WebDriverBiDiException

Thrown when the command is canceled, or its response carries no result or a result of the wrong type.

OperationCanceledException

Thrown when cancellationToken is canceled.

ObjectDisposedException

Thrown when the driver has been disposed.

NewSessionAsync(NewCommandParameters?, TimeSpan?, CancellationToken)

Creates a new session.

public Task<NewCommandResult> NewSessionAsync(NewCommandParameters? commandParameters = null, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)

Parameters

commandParameters NewCommandParameters

The parameters for the command. If omitted, or if null, the command is sent with default parameters.

timeoutOverride TimeSpan?

The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.

cancellationToken CancellationToken

A cancellation token used to propagate notification that the operation should be canceled. Omitting this argument is the equivalent of using None.

Returns

Task<NewCommandResult>

The result of the command containing the information about the new session.

Exceptions

ArgumentOutOfRangeException

Thrown when timeoutOverride is negative (other than InfiniteTimeSpan) or exceeds the maximum supported timer duration.

WebDriverBiDiCommandException

Thrown when the remote end returns an error response for the command.

WebDriverBiDiSerializationException

Thrown when the command parameters cannot be serialized, or the response cannot be deserialized.

WebDriverBiDiTimeoutException

Thrown when the command does not complete within the timeout.

WebDriverBiDiConnectionException

Thrown when the driver is not connected to a remote end, or the connection is lost before the command completes.

WebDriverBiDiException

Thrown when the command is canceled, or its response carries no result or a result of the wrong type.

OperationCanceledException

Thrown when cancellationToken is canceled.

ObjectDisposedException

Thrown when the driver has been disposed.

StatusAsync(StatusCommandParameters?, TimeSpan?, CancellationToken)

Gets the status of the remote end: whether it is in a state in which it can create new sessions, along with any implementation-specific information it reports.

public Task<StatusCommandResult> StatusAsync(StatusCommandParameters? commandParameters = null, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)

Parameters

commandParameters StatusCommandParameters

The parameters for the command. If omitted, or if null, the command is sent with default parameters.

timeoutOverride TimeSpan?

The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.

cancellationToken CancellationToken

A cancellation token used to propagate notification that the operation should be canceled. Omitting this argument is the equivalent of using None.

Returns

Task<StatusCommandResult>

The result of the command containing the information about the remote end status.

Exceptions

ArgumentOutOfRangeException

Thrown when timeoutOverride is negative (other than InfiniteTimeSpan) or exceeds the maximum supported timer duration.

WebDriverBiDiCommandException

Thrown when the remote end returns an error response for the command.

WebDriverBiDiSerializationException

Thrown when the command parameters cannot be serialized, or the response cannot be deserialized.

WebDriverBiDiTimeoutException

Thrown when the command does not complete within the timeout.

WebDriverBiDiConnectionException

Thrown when the driver is not connected to a remote end, or the connection is lost before the command completes.

WebDriverBiDiException

Thrown when the command is canceled, or its response carries no result or a result of the wrong type.

OperationCanceledException

Thrown when cancellationToken is canceled.

ObjectDisposedException

Thrown when the driver has been disposed.

SubscribeAsync(SubscribeCommandParameters, TimeSpan?, CancellationToken)

Subscribes to events for this session.

public Task<SubscribeCommandResult> SubscribeAsync(SubscribeCommandParameters commandParameters, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)

Parameters

commandParameters SubscribeCommandParameters

The parameters for the command.

timeoutOverride TimeSpan?

The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.

cancellationToken CancellationToken

A cancellation token used to propagate notification that the operation should be canceled. Omitting this argument is the equivalent of using None.

Returns

Task<SubscribeCommandResult>

The result of the command containing the subscription ID.

Exceptions

ArgumentNullException

Thrown when commandParameters is null.

ArgumentOutOfRangeException

Thrown when timeoutOverride is negative (other than InfiniteTimeSpan) or exceeds the maximum supported timer duration.

WebDriverBiDiCommandException

Thrown when the remote end returns an error response for the command.

WebDriverBiDiSerializationException

Thrown when the command parameters cannot be serialized, or the response cannot be deserialized.

WebDriverBiDiTimeoutException

Thrown when the command does not complete within the timeout.

WebDriverBiDiConnectionException

Thrown when the driver is not connected to a remote end, or the connection is lost before the command completes.

WebDriverBiDiException

Thrown when the command is canceled, or its response carries no result or a result of the wrong type.

OperationCanceledException

Thrown when cancellationToken is canceled.

ObjectDisposedException

Thrown when the driver has been disposed.

UnsubscribeAsync(UnsubscribeCommandParameters, TimeSpan?, CancellationToken)

Unsubscribes from events for this session.

public Task<UnsubscribeCommandResult> UnsubscribeAsync(UnsubscribeCommandParameters commandParameters, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)

Parameters

commandParameters UnsubscribeCommandParameters

The parameters for the command.

timeoutOverride TimeSpan?

The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.

cancellationToken CancellationToken

A cancellation token used to propagate notification that the operation should be canceled. Omitting this argument is the equivalent of using None.

Returns

Task<UnsubscribeCommandResult>

An empty command result.

Exceptions

ArgumentNullException

Thrown when commandParameters is null.

ArgumentOutOfRangeException

Thrown when timeoutOverride is negative (other than InfiniteTimeSpan) or exceeds the maximum supported timer duration.

WebDriverBiDiCommandException

Thrown when the remote end returns an error response for the command.

WebDriverBiDiSerializationException

Thrown when the command parameters cannot be serialized, or the response cannot be deserialized.

WebDriverBiDiTimeoutException

Thrown when the command does not complete within the timeout.

WebDriverBiDiConnectionException

Thrown when the driver is not connected to a remote end, or the connection is lost before the command completes.

WebDriverBiDiException

Thrown when the command is canceled, or its response carries no result or a result of the wrong type.

OperationCanceledException

Thrown when cancellationToken is canceled.

ObjectDisposedException

Thrown when the driver has been disposed.