Our business uses a browser program for operations. I can automate the navigation solution for this site and get some data at the end.
The site itself uses the regular framework very much. However, at the very end of my process, it fills my data not in a frame, but in an iFrame. There is also very extensive javascript throughout the site, which makes things dirty.
Capturing the iFrame src URL and opening an error on the page in a new browser (that is, the error text instead of the content is displayed on the page).
My question is:
How can I extract text from iFrame via VBA?
What I've tried so far (feel free to skip):
Customize specific iFrame in specific frame and capture innerHTML
With ie.document.frames(myFrameNum).document.getElementsByTagName("iframe")(1).document.body stringResult = .innerHTML
Configure a specific iFrame ID by ID in a specific frame and capture innerHTML
Dim iFrm As HTMLIFrame Set iFrm = ie.document.frames(myFrameNum).document.getElementByID("iFrameID") Debug.Print iFrm.document.body.innerText
Find any instances of iFrames and capture them (no results - maybe because iframe is embedded in the frame?)
Dim iFrm As HTMLIFrame Dim doc As HTMLDocument For iterator = 0 To ie.document.all.Length - 1 If TypeName(ie.document.all(iterator)) = "HTMLIFrame" Then Set iFrm = ie.document.all(iterator) Set doc = iFrm.document Debug.Print & doc.body.outerHTML End If Next
source share