Internet Explorer Automation: Accessing elements under Multiple Frames

Viewed 89

I am working on an automation which opens an intranet site in Internet explorer, inputs data and submit the information.

However the site is using multiple 'iframes' and 'frames' i.e. Under top level 'iframe', there will be another 'iframe' and inside that there will be another 'frame' which has the buttons and text boxes.

Top level iframe
  --control 1
  --control 2
  ....
  Second iframe
    ....
    Third iframe
    --control 1
    --control 2

I was able to access controls under the top level 'iframe', however my code is not identifying second 'iframes' onward and its elements.

How can I accomplish that?

Below is my code (frmMain is the top level iframe, modelframe1 and modalframe2 are the second and third ones)

Set doc = ie.Document

Set iframeDoc = doc.frames("frmMain").Document

Set objCollection = iframeDoc.getElementsByTagName("input")
objCount = 0
While objCount < objCollection.Length
    Debug.Print objCollection(objCount).Name
    If objCollection(objCount).Type = "submit" And objCollection(objCount).Name = "abc_name" Then 
        Set objElement = objCollection(objCount)
        objElement.Click
    End If
    objCount = objCount + 1
Wend 
0 Answers
Related