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
T
A DevToolsSessionDomains type specific to the version of Developer Tools with which to communicate.
Exceptions
- InvalidOperationException
If the provided
T
is 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
commandName
stringThe name of the command to send.
params
JsonNodeThe parameters of the command as a JsonNode object
cancellationToken
CancellationTokenA CancellationToken object to allow for cancellation of the command.
millisecondsTimeout
int?The execution timeout of the command in milliseconds.
throwExceptionIfResponseNotReceived
booltrue 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
commandName
is 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
command
TCommandThe command to be sent.
cancellationToken
CancellationTokenA CancellationToken object to allow for cancellation of the command.
millisecondsTimeout
int?The execution timeout of the command in milliseconds.
throwExceptionIfResponseNotReceived
booltrue 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
TCommand
A command object implementing the ICommand interface.
Exceptions
- ArgumentNullException
If
command
is 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
command
TCommandThe command to send.
cancellationToken
CancellationTokenA CancellationToken object to allow for cancellation of the command.
millisecondsTimeout
int?The execution timeout of the command in milliseconds.
throwExceptionIfResponseNotReceived
booltrue 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
TCommand
A command object implementing the ICommand interface.
TCommandResponse
A response object implementing the ICommandResponse interface.
Exceptions
- ArgumentNullException
If
command
is 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