8

I'm considering moving a project into an embedded WebView type architecture in a WinForm application and am considering DotNetBrowser and CefSharp.

After many searches I can't seem to find any comparison between the capabilities of the free CefSharp project vs the paid DotNetBrowser component. Is the primary difference the support options with DotNetBrowser are there other documented differences?

frigon
  • 4,979
  • 7
  • 32
  • 38
  • It's worth noting that `CefSharp` is, at this moment, currently unsupported as the developer who graciously gave their time over the last two years has moved away from the project indefinitely. (Note future readers this comment was written when version `57.0.0` was the latest version) – TEK Aug 06 '17 at 09:28
  • We wrote an article that compares two libraries, you can find it useful. No advertising, just technical stuff: https://blog.teamdev.com/embedding-browser-into-net-app-dotnetbrowser-or-cefsharp-cc94ae17f3bb – Vladyslav Lubenskyi Dec 07 '22 at 22:53

1 Answers1

6

The major difference between DotNetBrowser and CefSharp APIs is that DotNetBrowser provides the DOM layer API while CefSharp doesn't.

For example, in DotNetBrowser, you can get the DOM element using the following approach:

DOMDocument document = Browser.GetDocument();
DOMNode div = Browser.GetDocument().GetElementsByTagName("div").FirstOrDefault();

And then you can work with the DOM element using C#. For instance, DotNetBrowser supports subscribing to DOM events from .NET side.

To do this in CefSharp, you need to use JavaScript evaluation for working with DOM tree:

browser.GetMainFrame().ExecuteJavaScriptAsync("document.getElementsByTagName('div')[0]");
Jean-François Fabre
  • 137,073
  • 23
  • 153
  • 219
Eugene Yakush
  • 259
  • 4
  • 6