0

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?

Rexfelis
  • 57
  • 3
  • 10

3 Answers3

2

You can use JavaScript:

var data = (string)webView.EvalScript("document.body.outerHTML");
Floern
  • 33,559
  • 24
  • 104
  • 119
rainstuff
  • 21
  • 2
0

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.

Community
  • 1
  • 1
Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179
0

the eo.webbrowser runs multi-process like chrome and unsupported by many cloud service environment.

just use WebClient or HttpWebRequest or RestSharp or something like that can do http requests to get the response html.

user7697185
  • 61
  • 1
  • 3