【问题标题】:Working with frames in webbrowser Control在 webbrowser 控件中使用框架
【发布时间】:2011-10-18 13:44:53
【问题描述】:

我正在使用<webbrowser>.Document.Window.Frames 来获取帧。 我的<WebBrowser> 有 2 帧。我唯一的问题是,我的索引似乎是 0,但不是 1。

有什么帮助吗?

HtmlWindow wf = wb.Document.Window.Frames[1]; 
string s = wf.Document.Body.OuterHtml; 

并查看源代码

    <frameset rows="0,*" border="0" frameborder="0" framespacing="0"> 
    <frame name="entrustTruePassAppletFrame" src="EntrustTruePassApplet.html" marginwidth="0" marginheight="0" scrolling="no" noresize>
   <!-- It is mandatory for the frame where the user interaction happens to have the name  defined in the Configuration as appletHtmlGuiTarget--> 
<frame name="entrustTruePassGuiFrame" src="AuthenticateUserInputRoamingEPF.html"> </frameset>

【问题讨论】:

  • 你在问网页的源代码吗?
  • 是的,只是您声明框架的相关部分
  • 这是.net app中的代码:
  • HtmlWindow wf = wb.Document.Window.Frames[1];字符串 s = wf.Document.Body.OuterHtml;并查看源代码
  • 别忘了把它标记为答案 ;)

标签: c# asp.net vb.net web-controls


【解决方案1】:

尝试使用名称而不是索引来获取帧:

wb.Document.Window.Frames["entrustTruePassAppletFrame"];

实际上,我认为使用索引一点都不好,因为如果稍后您添加/删除单个帧,随着索引的变化,它会破坏您的所有工作。

【讨论】:

    猜你喜欢
    • 2011-11-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-16
    • 1970-01-01
    • 1970-01-01
    • 2010-12-02
    • 1970-01-01
    相关资源
    最近更新 更多