getElementsByName and getElementsByTagName Methods

The getElementsByName and getElementsByTagName methods can be used just like getElementById except that they return a collection of objects (as opposed to getElementById, which returns only the first matching object it finds.)

For example, the following script line will display a message indicating the number of images on the page - image objects have an "IMG" tag.

The example is written in VBScript. To write similar code in Python, use the print method instead of msgbox and adjust syntax as necessary.

Copy code
msgbox Browser("Yahoo").Page("Yahoo!").Object.getElementsByTagName("IMG").length