Interface ICDPConnection
- Namespace
- PuppeteerSharp
- Assembly
- PuppeteerSharp.dll
An ICDPConnection is an object able to send and receive messages from the browser.
public interface ICDPConnection
Methods
SendAsync(string, object, bool, CommandOptions)
Protocol methods can be called with this method.
Task<JsonElement?> SendAsync(string method, object args = null, bool waitForCallback = true, CommandOptions options = null)
Parameters
methodstringThe method name.
argsobjectThe method args.
waitForCallbackboolIf
truethe method will return a task to be completed when the message is confirmed by Chromium. Iffalsethe task will be considered complete after sending the message to Chromium.optionsCommandOptionsThe options.
Returns
- Task<JsonElement?>
The task.
Exceptions
- PuppeteerException
If the Connection is closed.
SendAsync<T>(string, object, CommandOptions)
Protocol methods can be called with this method.
Task<T> SendAsync<T>(string method, object args = null, CommandOptions options = null)
Parameters
methodstringThe method name.
argsobjectThe method args.
optionsCommandOptionsThe options.
Returns
- Task<T>
The task.
Type Parameters
TReturn type.
Events
MessageReceived
Occurs when message received from Chromium.
event EventHandler<MessageEventArgs> MessageReceived