Search code examples
javascriptc#httpwebrequest

C# Faster way to get javascript DOM than EO.WebBrowser


I have code in place where I'm using EO.WebBrowser to get the html from a page using the EO.WebView Request:

var cookie = new EO.WebBrowser.Cookie("cookie", "value");
cookie.Path = path;
cookie.Domain = domain;

var options = new BrowserOptions();
options.EnableWebSecurity = false;
Runtime.SetDefaultOptions(options);

var request = new Request(url);
request.Cookies.Add(cookie);

webView.LoadRequestAndWait(request);

Finally I use the following to get the HTML I need:

webView.GetDOMWindow().document.body.outerHTML

My issue is that this is very slow and although I can get it to run it locally, I can not get it to run on Azure server code. Is there a way to do the same thing using HttpWebRequest?


Solution

  • No, HttpWebRequest (and other similar "get me HTML response") methods will only give you HTML itself and will not run JavaScript on the page.

    For server side processing of dynamic HTML consider using proper headless internet browser? instead of trying to convince regular IE to work correctly without UI.