Table of Contents

Class BrowserModule

Namespace
WebDriverBiDi.Browser
Assembly
WebDriverBiDi.dll

The Browser module contains commands for managing the remote end browser process.

public sealed class BrowserModule : Module
Inheritance
BrowserModule
Inherited Members

Constructors

BrowserModule(IBiDiModuleHost)

Initializes a new instance of the BrowserModule class.

public BrowserModule(IBiDiModuleHost driver)

Parameters

driver IBiDiModuleHost

The IBiDiModuleHost used in the module commands and events.

Fields

BrowserModuleName

The name of the browser module.

public const string BrowserModuleName = "browser"

Field Value

string

Properties

ModuleName

Gets the module name.

public override string ModuleName { get; }

Property Value

string

Methods

CloseAsync(CloseCommandParameters?, TimeSpan?, CancellationToken)

Terminates all WebDriver sessions and cleans up automation state in the remote browser instance.

public Task<CloseCommandResult> CloseAsync(CloseCommandParameters? commandParameters = null, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)

Parameters

commandParameters CloseCommandParameters

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<CloseCommandResult>

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.

CreateUserContextAsync(CreateUserContextCommandParameters?, TimeSpan?, CancellationToken)

Creates a new user context for the browser.

public Task<CreateUserContextCommandResult> CreateUserContextAsync(CreateUserContextCommandParameters? commandParameters = null, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)

Parameters

commandParameters CreateUserContextCommandParameters

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<CreateUserContextCommandResult>

An object describing information about the user context created.

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.

GetClientWindowsAsync(GetClientWindowsCommandParameters?, TimeSpan?, CancellationToken)

Gets the list of information about the client windows for the current browser.

public Task<GetClientWindowsCommandResult> GetClientWindowsAsync(GetClientWindowsCommandParameters? commandParameters = null, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)

Parameters

commandParameters GetClientWindowsCommandParameters

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<GetClientWindowsCommandResult>

The result of the command, whose ClientWindows property is a read-only list of the client windows open in this browser.

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.

GetUserContextsAsync(GetUserContextsCommandParameters?, TimeSpan?, CancellationToken)

Gets the list of open user contexts for the browser.

public Task<GetUserContextsCommandResult> GetUserContextsAsync(GetUserContextsCommandParameters? commandParameters = null, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)

Parameters

commandParameters GetUserContextsCommandParameters

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<GetUserContextsCommandResult>

The result of the command, whose UserContexts property is a read-only list of the user contexts open in this browser.

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.

RemoveUserContextAsync(RemoveUserContextCommandParameters, TimeSpan?, CancellationToken)

Removes a user context for the browser.

public Task<RemoveUserContextCommandResult> RemoveUserContextAsync(RemoveUserContextCommandParameters commandParameters, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)

Parameters

commandParameters RemoveUserContextCommandParameters

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<RemoveUserContextCommandResult>

The result of the command.

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.

SetClientWindowStateAsync(SetClientWindowStateCommandParameters, TimeSpan?, CancellationToken)

Sets the state of a client window, including size and position. Note that the remote end may not be capable of setting the window to the requested state, and this may not necessarily return an error.

public Task<SetClientWindowStateCommandResult> SetClientWindowStateAsync(SetClientWindowStateCommandParameters commandParameters, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)

Parameters

commandParameters SetClientWindowStateCommandParameters

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<SetClientWindowStateCommandResult>

The actual state of the window after setting the state.

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.

SetDownloadBehaviorAsync(SetDownloadBehaviorCommandParameters, TimeSpan?, CancellationToken)

Sets the download behavior for the browser.

public Task<SetDownloadBehaviorCommandResult> SetDownloadBehaviorAsync(SetDownloadBehaviorCommandParameters commandParameters, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)

Parameters

commandParameters SetDownloadBehaviorCommandParameters

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<SetDownloadBehaviorCommandResult>

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.