示例#1
0
        static string GetHtml(string url)
        {
            WebClient webClient = new WebClient(BrowserVersion.CHROME);

            webClient.CssEnabled        = true;
            webClient.JavaScriptEnabled = true;
            //webClient.CookieManager = new CookieManager();
            //webClient.CookieManager.AddCookie(new Cookie("www.zujuan.com", "chid", "27e8704a451201531cc9941f6f3b709b7e13397751c04b090603ffdb0a56dfb9a:2:{i:0;s:4:\"chid\";i:1;s:1:\"2\";}"));
            var      page     = webClient.GetHtmlPage(url);
            var      button   = page.GetElementByClassName("item-list").GetElementsByTagName("a")[0] as HtmlAnchor;
            HtmlPage realpage = button.Click() as HtmlPage;

            webClient.WaitForBackgroundJavaScript(1000);
            var html = realpage.AsXml();

            webClient.Close();
            return(html);
        }