all, frames, images, and links Collections

Return a reference to the collection of elements contained by the object.

The all collection contains all the elements in the specified object. The frames property contains objects of type window (frame). The images property contains objects of type of img (image), and the links collections contains objects of types HREF and area.

  • length property - Sets or retrieves the number of objects in a collection.
  • item method - Retrieves an object from the all collection or various other collections.
  • namedItem method - Retrieves an object or a collection from the specified collection.

There are additional methods available for accessing some of the collections. For example, the images collection provides the tags method, which can be used to retrieve a collection of objects with a specified tag name. For details, see http://msdn.microsoft.com/en-us/library/ms535862(VS.85).aspx

The following example loops through all the INPUT tags, and displays a message indicating the number of tags checked:

Set inputs = Browser("Browser").Page("Page").Object.all.tags("INPUT")

'Loop over all inputs in this collection and get the 'checked' value:

    For Each inputBtn In inputs

        If inputBtn.checked Then

            checkedCount = checkedCount + 1

        End If

    Next



MsgBox checkedCount & " checkboxes are checked."

The following example displays a message indicating the number of frames in the specified Web page:

msgbox Browser("Yahoo").Page("Yahoo!").Object.frames.length