ICoreWebView2_11.CallDevToolsProtocolMethodForSession

Runs an asynchronous DevToolsProtocol method for a specific session of an attached target. There could be multiple DevToolsProtocol targets in a WebView. Besides the top level page, iframes from different origin and web workers are also separate targets. Attaching to these targets allows interaction with them. When the DevToolsProtocol is attached to a target, the connection is identified by a sessionId. To use this API, you must set the flatten parameter to true when calling Target.attachToTarget or Target.setAutoAttach DevToolsProtocol method. Using Target.setAutoAttach is recommended as that would allow you to attach to dedicated worker targets, which are not discoverable via other APIs like Target.getTargets. For more information about targets and sessions, navigate to DevTools Protocol Viewer. For more information about available methods, navigate to DevTools Protocol Viewer

The sessionId parameter is the sessionId for an attached target. nullptr or empty string is treated as the session for the default target for the top page. The methodName parameter is the full name of the method in the {domain}.{method} format. The parametersAsJson parameter is a JSON formatted string containing the parameters for the corresponding method. The Invoke method of the handler is run when the method asynchronously completes. Invoke is run with the return object of the method as a JSON string. This function returns E_INVALIDARG if the methodName is unknown or the parametersAsJson has an error. In the case of such an error, the returnObjectAsJson parameter of the handler will include information about the error.

\snippet ScriptComponent.cpp DevToolsProtocolMethodMultiSession

\snippet ScriptComponent.cpp CallDevToolsProtocolMethodForSession

interface ICoreWebView2_11
HRESULT
CallDevToolsProtocolMethodForSession

Meta