问题
First at all - I don't know if "render" is the right word. I like to get information from an website. At the moment therefore I use the WebBbrowser control. Now I like to use HttpWebRequests because I think, that's much faster and threading could be used more easily. But I can't use them, because the HTML-output string I receive from HttpWebRequest has got a lot of JavaScript inside from which the information, that I need, will be created. The web browser "renders" the JavaScript to readable HTML. How to do this step "by hand", so that I can use HttpWebRequests?
I hope you understand, what I want.
回答1:
so if you need the javascript rendering engine i suggest you have a look at selenium project.
回答2:
I solved my problem with a project called Awesomium. In this thread you will find all you need to get html with executed javascript. The "special part" is this one:
var sourceVal = webView.ExecuteJavascriptWithResult( "document.getElementsByTagName('html')[0].outerHTML;" );
if ( sourceVal != null )
{
using ( sourceVal )
{
html = sourceVal.ToString();
}
}
来源:https://stackoverflow.com/questions/10562051/how-to-render-html-without-webbrowser-control