Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
the easiest way to determine actual frames is using the IE dev toolbar like you mention you have.
the webbrowsers document property is the highest level document in the page. In the case of a frames page, this document generally has little more than the outline of how each individual frame will be displayed (ie where it will show up) and also what the source URL is for each frame.
Being that each frame has its own URL, it also has its own document. So EACH frame contains a document object, and that is where the HTML you want to get at is.
Now if you know the framenumber (by index) or the frame name/id (if it has one) then you can access frames by those values. If not, you can also loop all frames, and inside that loop, loop all links in each frames document.
it would look like this:
Code:
'LOOP ALL FRAMES OF THE MAIN DOCUMENT
For Each frameWindow As HtmlWindow In WebBrowser1.Document.Window.Frames
'LOOP EACH LINK IN THE CURRENT FRAME
For Each element As HtmlElement In frameWindow.Document.Links
If element.GetAttribute("href").Contains("Call_Detail_Records") Then
element.InvokeMember("Click")
Exit For
End If
Next
Next
note that the exit for that is called only will exit the inner loop. You might want to put this code in its own subroutine so you can call exit sub once the link is found and clicked, to avoid the routine looking through the rest of the page when it does not have to.
See this screenshot. I found a random frames page example on the web, then using the IE dev toolbar, I can see that the main document is a frameset, and has 2 frames, and you can see each frame has its own document object which we can access.