請參考下面的代碼:如何點擊HttpWebResponse中的鏈接(流)並獲得點擊響應再次?
string getData = "";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("A Web Site");
req.Method = "GET";
req.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
req.UserAgent = "Mozilla/5.0 (Windows NT 6.1; rv:15.0) Gecko/20100101 Firefox/15.0";
req.ContentType = "text/html; charset=utf-8";
req.Referer = "That Web Site Referer";
req.KeepAlive = true;
req.CookieContainer = cookieJar;
HttpWebResponse res = (HttpWebResponse)req.GetResponse();
Stream Stream = res.GetResponseStream();
StreamReader reader = new StreamReader(Stream);
string reader_str = reader.ReadToEnd();
運行這些代碼我們在reader_str源網頁字符串之後。
如何在reader_str &上單擊一個鏈接(使用特定的ID),然後再次獲得點擊響應,如上面的代碼?
我應該使用webBrowser還是HtmlAgilityPack?
你能否讓我看看最快的方式!
編輯:
該鏈接不在訪問。有一個JavaScript函數的圖像(onclick該圖像)。點擊該圖像後,js fn會創建一個url並將其回傳。我應提前單擊圖像上...
感謝
http://stackoverflow.com/questions/6063203/parsing-html-with-c-net –
感謝您的鏈接 - >但我怎麼能做到這一點使用HtmlAgilityPack - > InvokeMember(「點擊」) - >和我怎樣才能抓住點擊的響應呢? – MoonLight
http://runtingsproper.blogspot.com/2009/09/htmlagilitypack-article-series.html [other example] http://runtingsproper.blogspot.com/2009/09/introduction-to-htmlagilitypack-library.html其他一個http://runtingsproper.blogspot.com/2009/11/easily-extracting-links-from-snippet-of.html –