Search code examples
cefsharpdotnetbrowser

DotNetBrowser vs CefSharp Comparison


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?


Solution

  • 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]");