Closed daviduuang closed 1 year ago
Hello @daviduuang,
Thanks for your inquiry! I've assigned this to a dev that might best answer your question.
Recently, I found a way to intercept new log entries of browser by using Chrome DevTools Protocol.
In Domain "Log", you can enable\capture logs from webview2.
Using Method "CoreWebView2.GetDevToolsProtocolEventReceiver(String) ", you can regist event receiver to capture it.
The demo code works, as follows:
await this.webView.CoreWebView2.CallDevToolsProtocolMethodAsync("Log.enable", "{}");
var logEventReceiver = webView.CoreWebView2.GetDevToolsProtocolEventReceiver("Log.entryAdded");
logEventReceiver.DevToolsProtocolEventReceived += (s, e) =>
{
Console.WriteLine(e.ParameterObjectAsJson);
};
Reference:
Hi @daviduuang! It seems that you found the answer yourself. I am closing this issue.
I cannot find any API for capturing console messages.
The situation is I need to capture console messages and process them externally, e.g. submit all console log messages to Exceptionless .
In the past, I use CefSharp.WinForms to capture conole messages:
But I cannot find any similar APIs in WebView2.