Class NetworkModule
- Namespace
- WebDriverBiDi.Network
- Assembly
- WebDriverBiDi.dll
The Network module contains commands and events relating to network traffic.
public sealed class NetworkModule : Module
- Inheritance
-
NetworkModule
- Inherited Members
Constructors
NetworkModule(IBiDiModuleHost)
Initializes a new instance of the NetworkModule class.
public NetworkModule(IBiDiModuleHost driver)
Parameters
driverIBiDiModuleHostThe IBiDiModuleHost used in the module commands and events.
Fields
NetworkModuleName
The name of the network module.
public const string NetworkModuleName = "network"
Field Value
Properties
ModuleName
Gets the module name.
public override string ModuleName { get; }
Property Value
OnAuthRequired
Gets an observable event that notifies when an authorization required response is received.
[ObservableEventName("network.authRequired")]
public ObservableEvent<AuthRequiredEventArgs> OnAuthRequired { get; }
Property Value
OnBeforeRequestSent
Gets an observable event that notifies before a network request is sent.
[ObservableEventName("network.beforeRequestSent")]
public ObservableEvent<BeforeRequestSentEventArgs> OnBeforeRequestSent { get; }
Property Value
OnFetchError
Gets an observable event that notifies when an error is encountered fetching data.
[ObservableEventName("network.fetchError")]
public ObservableEvent<FetchErrorEventArgs> OnFetchError { get; }
Property Value
OnResponseCompleted
Gets an observable event that notifies when network response has completed.
[ObservableEventName("network.responseCompleted")]
public ObservableEvent<ResponseCompletedEventArgs> OnResponseCompleted { get; }
Property Value
OnResponseStarted
Gets an observable event that notifies when network response has started.
[ObservableEventName("network.responseStarted")]
public ObservableEvent<ResponseStartedEventArgs> OnResponseStarted { get; }
Property Value
Methods
AddDataCollectorAsync(AddDataCollectorCommandParameters, TimeSpan?, CancellationToken)
Adds a collector for network data such as response bodies, scoped by the data types to collect and, optionally, by browsing context or user context.
public Task<AddDataCollectorCommandResult> AddDataCollectorAsync(AddDataCollectorCommandParameters commandParameters, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
commandParametersAddDataCollectorCommandParametersThe parameters for the command.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA cancellation token used to propagate notification that the operation should be canceled. Omitting this argument is the equivalent of using None.
Returns
- Task<AddDataCollectorCommandResult>
The result of the command containing a data collector ID.
Exceptions
- ArgumentNullException
Thrown when
commandParametersis null.- ArgumentOutOfRangeException
Thrown when
timeoutOverrideis 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
cancellationTokenis canceled.- ObjectDisposedException
Thrown when the driver has been disposed.
AddInterceptAsync(AddInterceptCommandParameters, TimeSpan?, CancellationToken)
Adds an intercept for network traffic matching specific phases of the traffic and URL patterns.
public Task<AddInterceptCommandResult> AddInterceptAsync(AddInterceptCommandParameters commandParameters, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
commandParametersAddInterceptCommandParametersThe parameters for the command.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA cancellation token used to propagate notification that the operation should be canceled. Omitting this argument is the equivalent of using None.
Returns
- Task<AddInterceptCommandResult>
The result of the command containing a network interception ID.
Exceptions
- ArgumentNullException
Thrown when
commandParametersis null.- ArgumentOutOfRangeException
Thrown when
timeoutOverrideis 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
cancellationTokenis canceled.- ObjectDisposedException
Thrown when the driver has been disposed.
ContinueRequestAsync(ContinueRequestCommandParameters, TimeSpan?, CancellationToken)
Continues a paused request intercepted by the driver.
public Task<ContinueRequestCommandResult> ContinueRequestAsync(ContinueRequestCommandParameters commandParameters, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
commandParametersContinueRequestCommandParametersThe parameters for the command.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA cancellation token used to propagate notification that the operation should be canceled. Omitting this argument is the equivalent of using None.
Returns
- Task<ContinueRequestCommandResult>
The result of the command.
Exceptions
- ArgumentNullException
Thrown when
commandParametersis null.- ArgumentOutOfRangeException
Thrown when
timeoutOverrideis 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
cancellationTokenis canceled.- ObjectDisposedException
Thrown when the driver has been disposed.
ContinueResponseAsync(ContinueResponseCommandParameters, TimeSpan?, CancellationToken)
Continues a paused response intercepted by the driver after the response has been received from the server, but before presented to the browser.
public Task<ContinueResponseCommandResult> ContinueResponseAsync(ContinueResponseCommandParameters commandParameters, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
commandParametersContinueResponseCommandParametersThe parameters for the command.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA cancellation token used to propagate notification that the operation should be canceled. Omitting this argument is the equivalent of using None.
Returns
- Task<ContinueResponseCommandResult>
The result of the command.
Exceptions
- ArgumentNullException
Thrown when
commandParametersis null.- ArgumentOutOfRangeException
Thrown when
timeoutOverrideis 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
cancellationTokenis canceled.- ObjectDisposedException
Thrown when the driver has been disposed.
ContinueWithAuthAsync(ContinueWithAuthCommandParameters, TimeSpan?, CancellationToken)
Continues a paused request intercepted by the driver with authentication information.
public Task<ContinueWithAuthCommandResult> ContinueWithAuthAsync(ContinueWithAuthCommandParameters commandParameters, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
commandParametersContinueWithAuthCommandParametersThe parameters for the command.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA cancellation token used to propagate notification that the operation should be canceled. Omitting this argument is the equivalent of using None.
Returns
- Task<ContinueWithAuthCommandResult>
The result of the command.
Exceptions
- ArgumentNullException
Thrown when
commandParametersis null.- ArgumentOutOfRangeException
Thrown when
timeoutOverrideis 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
cancellationTokenis canceled.- ObjectDisposedException
Thrown when the driver has been disposed.
DisownDataAsync(DisownDataCommandParameters, TimeSpan?, CancellationToken)
Releases data from a network data collector for a specific request.
public Task<DisownDataCommandResult> DisownDataAsync(DisownDataCommandParameters commandParameters, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
commandParametersDisownDataCommandParametersThe parameters for the command.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA cancellation token used to propagate notification that the operation should be canceled. Omitting this argument is the equivalent of using None.
Returns
- Task<DisownDataCommandResult>
The result of the command.
Exceptions
- ArgumentNullException
Thrown when
commandParametersis null.- ArgumentOutOfRangeException
Thrown when
timeoutOverrideis 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
cancellationTokenis canceled.- ObjectDisposedException
Thrown when the driver has been disposed.
FailRequestAsync(FailRequestCommandParameters, TimeSpan?, CancellationToken)
Fails a paused request intercepted by the driver.
public Task<FailRequestCommandResult> FailRequestAsync(FailRequestCommandParameters commandParameters, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
commandParametersFailRequestCommandParametersThe parameters for the command.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA cancellation token used to propagate notification that the operation should be canceled. Omitting this argument is the equivalent of using None.
Returns
- Task<FailRequestCommandResult>
The result of the command.
Exceptions
- ArgumentNullException
Thrown when
commandParametersis null.- ArgumentOutOfRangeException
Thrown when
timeoutOverrideis 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
cancellationTokenis canceled.- ObjectDisposedException
Thrown when the driver has been disposed.
GetDataAsync(GetDataCommandParameters, TimeSpan?, CancellationToken)
Gets the collected data from a network data collector for a specific network request.
public Task<GetDataCommandResult> GetDataAsync(GetDataCommandParameters commandParameters, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
commandParametersGetDataCommandParametersThe parameters for the command.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA cancellation token used to propagate notification that the operation should be canceled. Omitting this argument is the equivalent of using None.
Returns
- Task<GetDataCommandResult>
The result of the command containing the collected network data.
Exceptions
- ArgumentNullException
Thrown when
commandParametersis null.- ArgumentOutOfRangeException
Thrown when
timeoutOverrideis 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
cancellationTokenis canceled.- ObjectDisposedException
Thrown when the driver has been disposed.
ProvideResponseAsync(ProvideResponseCommandParameters, TimeSpan?, CancellationToken)
Provides a full response for request intercepted by the driver without sending the request to the server.
public Task<ProvideResponseCommandResult> ProvideResponseAsync(ProvideResponseCommandParameters commandParameters, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
commandParametersProvideResponseCommandParametersThe parameters for the command.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA cancellation token used to propagate notification that the operation should be canceled. Omitting this argument is the equivalent of using None.
Returns
- Task<ProvideResponseCommandResult>
The result of the command.
Exceptions
- ArgumentNullException
Thrown when
commandParametersis null.- ArgumentOutOfRangeException
Thrown when
timeoutOverrideis 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
cancellationTokenis canceled.- ObjectDisposedException
Thrown when the driver has been disposed.
RemoveDataCollectorAsync(RemoveDataCollectorCommandParameters, TimeSpan?, CancellationToken)
Removes a network data collector.
public Task<RemoveDataCollectorCommandResult> RemoveDataCollectorAsync(RemoveDataCollectorCommandParameters commandParameters, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
commandParametersRemoveDataCollectorCommandParametersThe parameters for the command.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA cancellation token used to propagate notification that the operation should be canceled. Omitting this argument is the equivalent of using None.
Returns
- Task<RemoveDataCollectorCommandResult>
The result of the command.
Exceptions
- ArgumentNullException
Thrown when
commandParametersis null.- ArgumentOutOfRangeException
Thrown when
timeoutOverrideis 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
cancellationTokenis canceled.- ObjectDisposedException
Thrown when the driver has been disposed.
RemoveInterceptAsync(RemoveInterceptCommandParameters, TimeSpan?, CancellationToken)
Removes an added intercept for network traffic matching specific phases of the traffic and URL patterns.
public Task<RemoveInterceptCommandResult> RemoveInterceptAsync(RemoveInterceptCommandParameters commandParameters, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
commandParametersRemoveInterceptCommandParametersThe parameters for the command.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA cancellation token used to propagate notification that the operation should be canceled. Omitting this argument is the equivalent of using None.
Returns
- Task<RemoveInterceptCommandResult>
The result of the command.
Exceptions
- ArgumentNullException
Thrown when
commandParametersis null.- ArgumentOutOfRangeException
Thrown when
timeoutOverrideis 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
cancellationTokenis canceled.- ObjectDisposedException
Thrown when the driver has been disposed.
SetCacheBehaviorAsync(SetCacheBehaviorCommandParameters, TimeSpan?, CancellationToken)
Sets the cache behavior of the browser.
public Task<SetCacheBehaviorCommandResult> SetCacheBehaviorAsync(SetCacheBehaviorCommandParameters commandParameters, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
commandParametersSetCacheBehaviorCommandParametersThe parameters for the command.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA cancellation token used to propagate notification that the operation should be canceled. Omitting this argument is the equivalent of using None.
Returns
- Task<SetCacheBehaviorCommandResult>
The result of the command.
Exceptions
- ArgumentNullException
Thrown when
commandParametersis null.- ArgumentOutOfRangeException
Thrown when
timeoutOverrideis 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
cancellationTokenis canceled.- ObjectDisposedException
Thrown when the driver has been disposed.
SetExtraHeadersAsync(SetExtraHeadersCommandParameters, TimeSpan?, CancellationToken)
Sets extra headers to be set for each request sent by the browser. This will overwrite existing header values for those requests.
public Task<SetExtraHeadersCommandResult> SetExtraHeadersAsync(SetExtraHeadersCommandParameters commandParameters, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
commandParametersSetExtraHeadersCommandParametersThe parameters for the command.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA cancellation token used to propagate notification that the operation should be canceled. Omitting this argument is the equivalent of using None.
Returns
- Task<SetExtraHeadersCommandResult>
The result of the command.
Exceptions
- ArgumentNullException
Thrown when
commandParametersis null.- ArgumentOutOfRangeException
Thrown when
timeoutOverrideis 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
cancellationTokenis canceled.- ObjectDisposedException
Thrown when the driver has been disposed.