dfontanesi
14 years agoContributor
Find text on a page, even if it's in an iframe
I'm using the following code from the sample in the help:
Sub Test()
' Obtains the Page object and the document
Set Pg = GetPage()
Set Doc = GetDoc(Pg)
' Obtains the page's text
bodyText = Doc.body.innerText
' Searches for the "Samuel Clemens" string in the page
If InStr(bodyText, "Samuel Clemens") > 0 Then
Log.Message("Found!")
Else
Log.Warning("Not found")
End If
End Sub
But it won't match text that's contained in an iFrame. How can I accomplish that?
Sub Test()
' Obtains the Page object and the document
Set Pg = GetPage()
Set Doc = GetDoc(Pg)
' Obtains the page's text
bodyText = Doc.body.innerText
' Searches for the "Samuel Clemens" string in the page
If InStr(bodyText, "Samuel Clemens") > 0 Then
Log.Message("Found!")
Else
Log.Warning("Not found")
End If
End Sub
But it won't match text that's contained in an iFrame. How can I accomplish that?