How to get InnerText of IFrame from another site?

Posted by Eclipsed4utoo on Stack Overflow See other posts from Stack Overflow or by Eclipsed4utoo
Published on 2010-04-14T13:29:25Z Indexed on 2010/04/14 13:33 UTC
Read the original article Hit count: 236

Filed under:
|
|

I am trying to do some screen-scraping of a website. The content that I want to get is inside of an IFrame. How do I get the InnerText or HTML that is being displayed inside of the IFrame?

I am using .Net 4.0 and C#. I want to be able to do this from a WinForm.

I tried this, but can't find where to get the actual data from...

    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
        }
    }

I've tried searching through the element but couldn't find any of the HTML. Is this possible?

© Stack Overflow or respective owner

Related posts about c#

Related posts about screen-scraping