VBA - InterneExplorer Object (Frame)

2

I need to access a TAG (a) that is inside an Iframe that loads on the same page after a submit.

See how strange:

  • When I load the object in VBA code, I see the Iframe that I need, but the HTML inside the Iframe is not loaded into the VBA code object.
  • Is it possible to perform a forced update to the Object (HTMLIFrame) load all the html that appears on the page after the submit?

Has anyone ever had this problem?

See the code:

IE.Navigate "https://xxx.xxx"
WaitIE IE
IE.Document.all("ComponentID").innerText = "gem"
Set IEDoc = IE.Document
IE.Document.all("search").form.all("search").Click
WaitIE IE
Set IEDoc = IE.Document


Set profileFrame = IEDoc.getElementById("getPathBuffer") ' getPathBuffer = Nome do Iframe
Set objCollection = profileFrame.getElementsByTagName("a") 'TAG onde está o link que preciso clicar
i = 0
While i < objCollection.Length
    If objCollection(i).Name <> "" Then
        MsgBox objCollection(i).Name
    End If
    i = i + 1
Wend

    
asked by anonymous 15.02.2016 / 00:56

1 answer

1

Switch:

Set profileFrame = IEDoc.getElementById("getPathBuffer") ' getPathBuffer = Nome do Iframe
Set objCollection = profileFrame.getElementsByTagName("a") 'TAG onde está o link que preciso clicar

by:

Set objCollection = ie.Document.frames(0).Document.getElementsByTagName("a") 'o indice numerico é a posição do seu frame**

If I was useful, vote for the answer:)

    
29.11.2016 / 18:58