Table of Contents

Class NetworkManager

Namespace
OpenQA.Selenium
Assembly
WebDriver.dll

Provides methods for monitoring, intercepting, and modifying network requests and responses.

public class NetworkManager : INetwork
Inheritance
NetworkManager
Implements
Inherited Members

Constructors

NetworkManager(IWebDriver)

Initializes a new instance of the NetworkManager class.

public NetworkManager(IWebDriver driver)

Parameters

driver IWebDriver

The IWebDriver instance on which the network should be monitored.

Methods

AddAuthenticationHandler(NetworkAuthenticationHandler)

Adds a NetworkAuthenticationHandler to supply authentication credentials for network requests.

public void AddAuthenticationHandler(NetworkAuthenticationHandler handler)

Parameters

handler NetworkAuthenticationHandler

The NetworkAuthenticationHandler to add.

AddRequestHandler(NetworkRequestHandler)

Adds a NetworkRequestHandler to examine incoming network requests, and optionally modify the request or provide a response.

public void AddRequestHandler(NetworkRequestHandler handler)

Parameters

handler NetworkRequestHandler

The NetworkRequestHandler to add.

AddResponseHandler(NetworkResponseHandler)

Adds a NetworkResponseHandler to examine received network responses, and optionally modify the response.

public void AddResponseHandler(NetworkResponseHandler handler)

Parameters

handler NetworkResponseHandler

The NetworkResponseHandler to add.

ClearAuthenticationHandlers()

Clears all added NetworkAuthenticationHandler instances.

public void ClearAuthenticationHandlers()

ClearRequestHandlers()

Clears all added NetworkRequestHandler instances.

public void ClearRequestHandlers()

ClearResponseHandlers()

Clears all added NetworkResponseHandler instances.

public void ClearResponseHandlers()

StartMonitoring()

Asynchronously starts monitoring for network traffic.

public Task StartMonitoring()

Returns

Task

A task that represents the asynchronous operation.

StopMonitoring()

Asynchronously stops monitoring for network traffic.

public Task StopMonitoring()

Returns

Task

A task that represents the asynchronous operation.

Events

NetworkRequestSent

Occurs when a browser sends a network request.

public event EventHandler<NetworkRequestSentEventArgs> NetworkRequestSent

Event Type

EventHandler<NetworkRequestSentEventArgs>

NetworkResponseReceived

Occurs when a browser receives a network response.

public event EventHandler<NetworkResponseReceivedEventArgs> NetworkResponseReceived

Event Type

EventHandler<NetworkResponseReceivedEventArgs>