Cefsharp: Capture Devtools Console output

Created on 18 Jul 2015  路  6Comments  路  Source: cefsharp/CefSharp

Hello,

Is it possible to capture the Dev tools console output and display it in my .NET app ?

Thanks

Most helpful comment

All 6 comments

There is nothing specific for it in CefSharp. But as Devtools is implemented in JavaScript it's "just" a matter of injecting some JS and using EvaluateScriptAsync.

So it's more of an upstream CEF/Chromium question and you have to dig around there to see if there's a sensible API exposed. A few starting points:

  • https://developer.chrome.com/extensions/devtools probably isn't available in CEF as it's an Chrome Extension API (and those are generally only available in Google Chrome - not the open source Chromium)
  • https://developer.chrome.com/devtools/docs/debugger-protocol via e.g. C# WebRequestmight be an alternative depending on what you really want/need
  • Lacking a proper stable API simply dig around the DOM of the console and hack something. Though this may sound terrible the good part is that you are in complete control of when you push upgrades - still you have to verify each time :-(

Good catch @amaitland :smile: I completely forgot about that one!

Exactly what I need - Thank you!

The DevTools reference in the initial question was a little misleading. Initially I read the question the same way @jornh did :smile:

@amaitland

For basic console messages there is of course https://github.com/cefsharp/CefSharp/blob/master/CefSharp/IWebBrowser.cs#L14

Awesome. I was looking for this all over the internet full day.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

looselive picture looselive  路  4Comments

jdc20181 picture jdc20181  路  4Comments

amaitland picture amaitland  路  3Comments

marci4 picture marci4  路  4Comments

rfgamaral picture rfgamaral  路  4Comments