CoreWebView2.CallDevToolsProtocolMethodAsync(String, String) Method

Definition

Runs an asynchronous DevToolsProtocol method.

public System.Threading.Tasks.Task<string> CallDevToolsProtocolMethodAsync (string methodName, string parametersAsJson);
member this.CallDevToolsProtocolMethodAsync : string * string -> System.Threading.Tasks.Task<string>
Public Function CallDevToolsProtocolMethodAsync (methodName As String, parametersAsJson As String) As Task(Of String)

Parameters

methodName
String

The full name of the method in the format {domain}.{method}.

parametersAsJson
String

A JSON formatted string containing the parameters for the corresponding method.

Returns

A JSON string that represents the method's return object.

Remarks

For more information about available methods, navigate to DevTools Protocol Viewer. The returned task is completed when the method asynchronously completes and will return the method's return object as a JSON string. Note even though WebView2 dispatches the CDP messages in the order called, CDP method calls may be processed out of order. If you require CDP methods to run in a particular order, you should await for the previous method call.

If the method is to run in NewWindowRequested handler it should be called before the new window is set if the cdp messages should affect the initial navigation. If called after setting the NewWindow property, the cdp messages may or may not apply to the initial navigation and may only apply to the subsequent navigation. For more details NewWindow.

Applies to