Ahmad Bakro

Ahmad Bakro

  • NA
  • 10
  • 0

C# Copy Frame of webpage

Mar 4 2012 3:34 PM
Hi,
I am trying to copy the contents of a FRAME inside a webpage opened in IE, I have been using this code :


IEnumerable<dynamic> FindAllIE()
        {
            var t = Type.GetTypeFromProgID("Shell.Application");
            dynamic o = Activator.CreateInstance(t);
            try
            {
                var ws = o.Windows();
                for (int i = 0; i < ws.Count; i++)
                {
                    var ie = ws.Item(i);
                    if (ie != null && System.IO.Path.GetFileName((string)ie.FullName) == "IEXPLORE.EXE")
                        yield return ie;
                }
            }
            finally
            {
                Marshal.FinalReleaseComObject(o);
            }
}
===========================
And then I use the following code to copy the text:

private void FindIEWindows()
        {
            foreach (var ie in FindAllIE())
            {
               IE_Window_Text = (string)ie.Document.body.innerText + Environment.NewLine;
            }
        }
==============================
The problem is that the text I get does not include the text inside the FRAMEs, as the webpage has some frames in it.

Is there a way to copy the text that inside a FRAME ??
Any help is appreciated and thanks in advance..










Answers (1)