Common DOM Methods & Properties
Every HTML element in a Web page is a scriptable object in the object model, with its own set of properties, methods, and events. To enable access to these objects, Internet Explorer creates a top-level document object for each HTML document it displays. When you use the .Object property on a Web page object in your test or component, you actually get a reference to this DOM object. This document object represents the entire page. From this document object, you can access the rest of the object hierarchy by using properties and collections.
Following are the most useful document properties and methods available through the Web .Object property:
Properties
activeElement Property - Retrieves the object that has the focus when the parent document has focus.
cookie Property - Sets or retrieves the string value of a cookie.
documentElement Property - Retrieves a reference to the root node of the document.
readyState Property - Retrieves a value that indicates the current state of the object.
URL Property - Sets or retrieves the URL for the current document.
URLUnencoded Property - Retrieves the URL for the document, stripped of any character encoding.
Collections
all, frames, images, and links Collections - Returns a reference to the collection of elements contained by the object.
all, frames, images, and links Collections - Retrieves a collection of all window objects defined by the given document or defined by the document associated with the given window.
all, frames, images, and links Collections - Retrieves a collection, in source order, of img objects in the document.
all, frames, images, and links Collections - Retrieves a collection of all objects that specify the HREF property and all area objects in the document.
Methods
getElementById Method Returns a reference to the first object with the specified value of the ID attribute.
getElementsByName and getElementsByTagName Methods Method - Retrieves a collection of objects based on the value of the NAME attribute.
getElementsByName and getElementsByTagName Methods Method - Retrieves a collection of objects based on the specified element name.
Note that some of these properties are also provided by Test Objects. For example, it is possible to access the cookies set by a Web page both through the cookie property in the DOM, and through the GetCookies method provided by the Browser Test Object.