【发布时间】:2012-09-30 08:02:05
【问题描述】:
在 IE 或 Chrome 中使用开发人员工具,我得到一个框架的 html 代码。没问题。
现在,我想使用 C# 应用程序来实现。我在 VS2010 中有 System.Windows.Form.WebBrowser。我尝试获取 Frame 的 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;
有什么建议吗?
【问题讨论】:
标签: c# iframe browser unauthorizedaccessexcepti