Working with frames in webbrowser Control

点点圈 提交于 2019-12-07 15:08:39

问题


I am using <webbrowser>.Document.Window.Frames to get frames. My <WebBrowser> having 2 frames.My only problem is ,I seem one at index 0, but not 1.

Any help?

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

and view source

    <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>

回答1:


Try getting frames using their name instead of index:

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

Actually I think using index is not good at all, because if at a later time you add/remove a single frame it ruins all your work as the indexes changes.



来源:https://stackoverflow.com/questions/7808219/working-with-frames-in-webbrowser-control

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!