Working with frames in webbrowser Control

10,685

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.

Share:
10,685
user989888
Author by

user989888

Updated on June 30, 2022

Comments

  • user989888
    user989888 almost 2 years

    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>