Table of Contents

Class WebSocketConnection

Namespace
OpenQA.Selenium.DevTools
Assembly
WebDriver.dll

Represents a connection to a WebDriver Bidi remote end.

public class WebSocketConnection
Inheritance
WebSocketConnection
Inherited Members

Constructors

WebSocketConnection()

Initializes a new instance of the WebSocketConnection class.

public WebSocketConnection()

WebSocketConnection(TimeSpan)

Initializes a new instance of the WebSocketConnection class with a given startup timeout.

public WebSocketConnection(TimeSpan startupTimeout)

Parameters

startupTimeout TimeSpan

The timeout before throwing an error when starting up the connection.

WebSocketConnection(TimeSpan, TimeSpan)

Initializes a new instance of the WebSocketConnection class with a given startup and shutdown timeout.

public WebSocketConnection(TimeSpan startupTimeout, TimeSpan shutdownTimeout)

Parameters

startupTimeout TimeSpan

The timeout before throwing an error when starting up the connection.

shutdownTimeout TimeSpan

The timeout before throwing an error when shutting down the connection.

Properties

BufferSize

Gets the buffer size for communication used by this connection.

public int BufferSize { get; }

Property Value

int

IsActive

Gets a value indicating whether this connection is active.

public bool IsActive { get; }

Property Value

bool

Methods

CloseClientWebSocket()

Asynchronously closes the client WebSocket.

protected virtual Task CloseClientWebSocket()

Returns

Task

The task object representing the asynchronous operation.

OnDataReceived(WebSocketConnectionDataReceivedEventArgs)

Raises the DataReceived event.

protected virtual void OnDataReceived(WebSocketConnectionDataReceivedEventArgs e)

Parameters

e WebSocketConnectionDataReceivedEventArgs

The event args used when raising the event.

OnLogMessage(DevToolsSessionLogMessageEventArgs)

Raises the LogMessage event.

protected virtual void OnLogMessage(DevToolsSessionLogMessageEventArgs e)

Parameters

e DevToolsSessionLogMessageEventArgs

The event args used when raising the event.

SendData(string)

Asynchronously sends data to the remote end of this connection.

public virtual Task SendData(string data)

Parameters

data string

The data to be sent to the remote end of this connection.

Returns

Task

The task object representing the asynchronous operation.

Start(string)

Asynchronously starts communication with the remote end of this connection.

public virtual Task Start(string url)

Parameters

url string

The URL used to connect to the remote end.

Returns

Task

The task object representing the asynchronous operation.

Exceptions

TimeoutException

Thrown when the connection is not established within the startup timeout.

Stop()

Asynchronously stops communication with the remote end of this connection.

public virtual Task Stop()

Returns

Task

The task object representing the asynchronous operation.

Events

DataReceived

Occurs when data is received from this connection.

public event EventHandler<WebSocketConnectionDataReceivedEventArgs> DataReceived

Event Type

EventHandler<WebSocketConnectionDataReceivedEventArgs>

LogMessage

Occurs when a log message is emitted from this connection.

public event EventHandler<DevToolsSessionLogMessageEventArgs> LogMessage

Event Type

EventHandler<DevToolsSessionLogMessageEventArgs>