Interface IDevToolsSession
Represents a WebSocket connection to a running DevTools instance that can be used to send commands and receive events.
public interface IDevToolsSession : IDisposable
- Inherited Members
Methods
GetVersionSpecificDomains<T>()
Gets the domains that are valid for the specified version of Developer Tools connection.
T GetVersionSpecificDomains<T>() where T : DevToolsSessionDomains
Returns
- T
The version-specific domains for this Developer Tools connection.
Type Parameters
TA DevToolsSessionDomains type specific to the version of Developer Tools with which to communicate.
Exceptions
- InvalidOperationException
If the provided
Tis not the right protocol version which is running.
SendCommand(string, JsonNode, CancellationToken, int?, bool)
Returns a JsonNode based on a command created with the specified command name and params.
Task<JsonElement?> SendCommand(string commandName, JsonNode @params, CancellationToken cancellationToken, int? millisecondsTimeout, bool throwExceptionIfResponseNotReceived)
Parameters
commandNamestringThe name of the command to send.
paramsJsonNodeThe parameters of the command as a JsonNode object
cancellationTokenCancellationTokenA CancellationToken object to allow for cancellation of the command.
millisecondsTimeoutint?The execution timeout of the command in milliseconds.
throwExceptionIfResponseNotReceivedbooltrue to throw an exception if a response is not received; otherwise, false.
Returns
- Task<JsonElement?>
The command response object implementing the ICommandResponse<T> interface.
Exceptions
- ArgumentNullException
If
commandNameis null.
SendCommand<TCommand>(TCommand, CancellationToken, int?, bool)
Sends the specified command and returns the associated command response.
Task<ICommandResponse<TCommand>?> SendCommand<TCommand>(TCommand command, CancellationToken cancellationToken, int? millisecondsTimeout, bool throwExceptionIfResponseNotReceived) where TCommand : ICommand
Parameters
commandTCommandThe command to be sent.
cancellationTokenCancellationTokenA CancellationToken object to allow for cancellation of the command.
millisecondsTimeoutint?The execution timeout of the command in milliseconds.
throwExceptionIfResponseNotReceivedbooltrue to throw an exception if a response is not received; otherwise, false.
Returns
- Task<ICommandResponse<TCommand>>
The command response object implementing the ICommandResponse<T> interface.
Type Parameters
TCommandA command object implementing the ICommand interface.
Exceptions
- ArgumentNullException
If
commandis null.
SendCommand<TCommand, TCommandResponse>(TCommand, CancellationToken, int?, bool)
Sends the specified command and returns the associated command response.
Task<TCommandResponse?> SendCommand<TCommand, TCommandResponse>(TCommand command, CancellationToken cancellationToken, int? millisecondsTimeout, bool throwExceptionIfResponseNotReceived) where TCommand : ICommand where TCommandResponse : ICommandResponse<TCommand>
Parameters
commandTCommandThe command to send.
cancellationTokenCancellationTokenA CancellationToken object to allow for cancellation of the command.
millisecondsTimeoutint?The execution timeout of the command in milliseconds.
throwExceptionIfResponseNotReceivedbooltrue to throw an exception if a response is not received; otherwise, false.
Returns
- Task<TCommandResponse>
The command response object implementing the ICommandResponse<T> interface.
Type Parameters
TCommandA command object implementing the ICommand interface.
TCommandResponseA response object implementing the ICommandResponse interface.
Exceptions
- ArgumentNullException
If
commandis null.
Events
DevToolsEventReceived
Event raised an event notification is received from the DevTools session.
event EventHandler<DevToolsEventReceivedEventArgs>? DevToolsEventReceived
Event Type
LogMessage
Event raised when the DevToolsSession logs informational messages.
event EventHandler<DevToolsSessionLogMessageEventArgs>? LogMessage