Using Developer Tools in IE or Chrome, I get html code for a frame. No problem.
Now, I want do it using C# application. I have System.Windows.Form.WebBrowser in VS2010. I try get Html code for a Frame.
public static HtmlElementCollection GetElementsByTagNameForFrame(this WebBrowser wb,
string tag, string idFrame)
{
return wb.Document.Window.Frames[idFrame].Document.GetElementsByTagName(tag);
}
but I get error UnauthorizedAccessException.
I try again like this Read HTML code from iframe using Webbrowser C# but I get the same error.
string content = doc.Window.Frames["injected-iframe"].WindowFrameElement.InnerText;
Any suggestions ?