[英]How to get InnerText of IFrame from another site?
我正在嘗試對網站進行屏幕抓取。 我要獲取的內容位於IFrame中。 如何獲得在IFrame內部顯示的InnerText或HTML?
我正在使用.Net 4.0和C#。 我希望能夠從WinForm做到這一點。
我試過了,但是找不到從哪里獲取實際數據...
void PageCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
WebBrowser b = sender as WebBrowser;
string response = b.DocumentText;
HtmlElement element = b.Document.GetElementById("profileFrame");
if (element != null)
{
// do something with the data
}
}
我嘗試搜索該element
但找不到任何HTML。 這可能嗎?
iframe的內容未包含在第一個文檔中。 您需要再次向iframe的源地址發出請求,以使內容顯示在iframe中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.