0

We are using DotNetBrowser.dll in WPF application, We have a following question:

1) HTML part is not getting rendered in WPF BrowserView without using waitEvent.waitOne(5000). We have tried to load HTML on both events:

a) onCompleted

b) OnDataReceived by using the AjaxHandler.

Please confirm if WPF Browserview requires some time to load HTML. Please update me on the same. Following is my code.

//waitEvent.WaitOne(5000);

foreach (long frameId in BrowserView.Browser.GetFramesIds())
{

       frameDocument = BrowserView.Browser.GetDocument(frameId);

}

List<DOMNode> nodeslist = frameDocument.GetElementsByClassName("className");

The nodeslist always return null if we comment the waitEvent.WaitOne(5000) line.

Note: When we add waitEvent.waitOne(5000) everything works fine.

Jay Buckman
  • 581
  • 5
  • 18
  • The `Browser.GetDocument()` method can return null until the web page is loaded completely, according to https://dotnetbrowser.support.teamdev.com/solution/articles/9000110028-document-element. Is the web page loaded completely in your case when your application calls `GetDocument()` and obtains the list of nodes? – Anna Dolbina Feb 21 '19 at 14:28
  • You can assume that the page is loaded completely after receiving the FinishLoadingFrameEvent for the main frame. At that point, you can execute JavaScript, work with DOM, etc. See https://dotnetbrowser.support.teamdev.com/support/solutions/articles/9000110054-loading-url – Anna Dolbina Feb 21 '19 at 14:31

0 Answers0