IE または Chrome で開発者ツールを使用して、フレームの HTML コードを取得します。問題ない。
今、私はC#アプリケーションを使用してそれをやりたい. VS2010 に System.Windows.Form.WebBrowser があります。フレームの Html コードを取得しようとしています。
public static HtmlElementCollection GetElementsByTagNameForFrame(this WebBrowser wb,
string tag, string idFrame)
{
return wb.Document.Window.Frames[idFrame].Document.GetElementsByTagName(tag);
}
しかし、UnauthorizedAccessExceptionというエラーが発生します。
このRead HTML code from iframe using Webbrowser C#のように再試行しますが、同じエラーが発生します。
string content = doc.Window.Frames["injected-iframe"].WindowFrameElement.InnerText;
助言がありますか ?