Saturday, June 11, 2011

Common DOM Methods and 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 - Returns a reference to the collection of elements contained by the object.
frames - Retrieves a collection of all window objects defined by the given document or defined by the document associated with the given window.
images - Retrieves a collection, in source order, of img objects in the document.
links - 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 Method - Retrieves a collection of objects based on the value of the NAME attribute.
getElementsByTagName Method - Retrieves a collection of objects based on the specified element name.
Note that some of these properties are also provided by QuickTest 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.

6 comments:

  1. Advance your career with expert-led tableau developer training
    designed to build strong data visualization and dashboarding skills. Gain hands-on experience in real-world projects and master advanced concepts through comprehensive tableau developer training programs.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. power bi online training
    equips you with the skills to create interactive dashboards, build powerful reports, and transform raw data into actionable insights. Join our Power BI Online Training to master data visualization, DAX, and real-time analytics from industry experts.

    ReplyDelete
  4. Enroll in salesforce admin course
    to master user management, automation, reports, and security in the world’s leading CRM platform.

    ReplyDelete
  5. Advance your career with salesforce development course
    designed to help you master Apex, Lightning, and real-world CRM solutions.

    ReplyDelete
  6. An ios app development course provides structured training for creating applications on Apple devices. It explains Swift programming and Xcode tools clearly. This ios app development course emphasizes real-time project work. It improves UI design and performance optimization skills. Learners build functional iPhone applications. It is reliable and professional.

    ReplyDelete