QTP access to the DOM methods

2011-04-19  来源:本站原创  分类:Development  人气:146 

QTP supports direct access to DOM (Document Object Model), can be accessed through the DOM HTML tags. In QTP, the access to the DOM is a test object by using the Page Object property to further access. We are here with Object.getElementById usage, to obtain the object from the DOM;
For example:
Browser ("name: = Baidu, you know"). Page ("title: = Baidu, you know"). Object.getElementByID ("kw"). Value = "helloworld" 'input box in Baidu value
Browser ("name: = Baidu, you know"). Page ("title: = Baidu, you know"). Object.getElementByID ("sb"). Click 'Click Baidu is the search which kw sb included in the outerhtml

Common DOM attribute ● className. The elements of the same style rules with the same class name. ClassName quickly filtered out by a group of similar elements.
● document. To point to elements of the document contains the current object.
● id. The identity of the current element. If your document contains more than one element the same id, it returns an array.
● innerHTML. Used to point to the current element's start tag and end tag and all text between HTML tags.
● innerText. Used to point to the current element's start tag and end tag and all text between HTML tags.
● offsetHeight, offsetWidth. Elements of the height and width.
● offsetLeft, offsetTop. Father of the current elements of the same elements for the left position and top position.
● outerHTML. The current element's start tag and end tag and all text between HTML tags.
● outerText. The current element's start tag and end all the text between the tags, but does not include HTML tags.
● parentElement. The father of the current element element.
● sourceIndex. Document.all collection of elements in the index (index).
● style. Element of style sheets properties.
● tagName. Current element tag name.
● title. In IE, on behalf of elements of the tool tip text.
Common DOM Methods ● click (). Simulated user mouse clicks on the current element.
● contains (element). To determine whether the current element contains the specified element.
● getAttribute (attributeName, caseSensitive). Returns the current element contains an attribute, parameter attributeName the attribute name, caseSensitive that is case sensitive.
● setAttribute (attributeName, value, caseSenstive). Set the current element.
Common DOM collection ● All []. The current element contains all the HTML elements of the array.
● children []. The current element contains child elements.

getElementById (id) (document)
Obtain a unique ID attribute value specified elements in the document
getElementsByTagName (name)
Returns the current element in the specified tag name of the child elements of the array
hasChildNodes ()
Returns a Boolean value that indicates whether the element has child elements
getAttribute (name)
Returns the element attribute value, attribute name specified by the

相关文章
  • QTP access to the DOM methods 2011-04-19

    QTP supports direct access to DOM (Document Object Model), can be accessed through the DOM HTML tags. In QTP, the access to the DOM is a test object by using the Page Object property to further access. We are here with Object.getElementById usage, to

  • JavaScript access to HTML DOM node element method summary 2009-03-30

    At Web application development in particular Web2.0 often to access a page element, then update the elements of style, content, etc.. How to obtain the elements to be updated, is the first problem to be solved. It is gratifying that the use of JavaSc

  • Access request, session, application methods 2010-12-26

    Access request, session, application of the method: ActionContext get (Object), getSession, getApplication () These three methods were able to obtain Map type of request, session.application, you first need to take the time to get a ActionContext obj

  • xml parsing using dom methods android attached source file 2010-04-27

    Using dom parsing xml file is not recommended, dom xml parsing mechanism is to first read xml file in memory, then the composition of the tree, so the advantage of easy to understand. You can get him through a node in the parent node and child nodes,

  • Common javaScript DOM methods and properties 2010-08-04

    1. CreateElement (element) Create a specified tag name to create a new element node, the return value is a reference point to the new element node pointer. eg) var para = document.createElement("p"); document.body.appendChild(para); 2. CreateTex

  • JDBC access to database metadata methods classified information 2011-01-06

    Recently had an auto-generated code tools. There are many online tools in this area, but not very relevant to their own projects. All intend to write their own framework for their project-based code generator. Main idea, the user database table as lo

  • JDBC access to database metadata methods of classified information 2011-01-06

    Recently to be a tool for automatic code generation class. There are many online tools for this, but do not quite meet their own projects. All intend to write their own projects based on their own framework code generator. Main idea, as long as the u

  • JS DOM element properties and methods of operation 1 2011-05-21

    Dom element method for the basic operation API, the first recorded for later use. W3C DOM and JavaScript are easily confused. HTML and XML DOM is a document for the API, provides the structure for the representation of the document, and defines how t

  • javascript access to the html dom element node Ways summary 2009-04-01

    At Web application development in particular Web2.0 often to access a page element, then update the elements of style, content, etc.. How to obtain the elements to be updated, is the first problem to be solved. It is gratifying that the use of JavaSc

  • XML-operation of four methods (a) DOM method 2010-11-12

    Recent frequent use of XML, because when writing web pages, you need to use FushionChart drawing, which involves the operation of XML, today google search some information in preparation for some four logs, each one to write a method here is the firs

  • (Turn) proficient in JavaScript DOM events 2009-01-22

    Event (I) JavaScript Event List Event explain the general onclick event to trigger this event when the mouse clicks ondblclick this event is triggered when the mouse double-click the onmousedown This event is triggered by pressing the mouse onmouseup

  • [Change W3School Tutorial] JavaScript HTML DOM object 2010-01-03

    JavaScript HTML DOM object Previous Page Next Page In addition to the built-in JavaScript objects outside, you can also use JavaScript to access and deal with all of the HTML DOM objects. JavaScript Object click the link below for more, get more info

  • java operations xml (sax, dom, jdom, dom4j) additions or deletions to change search 2009-03-22

    Recently at work, often designed to report (ireport + jasperReport) repeated and design templates to deal with xml, so there is the idea of writing this article. java operating xml There are four main ways: dom, sax, jdom, dom4j. Have their own advan

  • JavaScript journey Study Notes (8) operation DOM Document (1) 2010-05-30

    The entire document is composed of a collection of many nodes, the node refers to elements in the document and the elements contained in the text. These nodes can have different node types. Each node in the document tree object has a nodeType propert

  • dom jQuery object and the object of mutual transformation 2010-07-06

    Just started learning jQuery, may be you could not tell what a moment jQuery object, which is a DOM object. The DOM object much to explain, we have come too much, concentrate on the following jQuery, and the conversion between the two. What is a jQue

  • Using php to read and write xml dom (using the DOM library. SAX parser and regular expressions) 2010-07-15

    There are many techniques can be used with PHP to read and write XML. This article provides three methods of reading XML: using the DOM library, using the SAX parser and use regular expressions. Also introduced the use of DOM and PHP text template pr

  • javascript DOM programming arts reading notes 2010-09-06

    javascript DOM programming arts reading notes The first part of the directory Chapter 1 Origin of JavaScript 1.1 JavaScript 1.2 A Brief History of the browser war 1.3 standard 1.4 Summary Chapter 2, JavaScript 2.2 Grammar 2.1 Grammar 2.3 statement pr

  • JS DOM entry application: DHTML object model and the comparison 2010-10-19

    DOM is the Document Object Model (Document Object Model) for short. DHTML object model used by developers will be able to operate very skilled HTML content of each tag on the page, but if using DOM technology, we can through a more direct and simple

  • jQuery object conversion method between DOM objects 2010-11-01

    What is a jQuery object? --- Is packed jQuery DOM object through the resulting object. jQuery jQuery object is unique, it can use jQuery in the method. For example: $ ("# Test"). Html () means: to get the element ID for the test within the html

  • jquery dom object object 2011-05-31

    What is a jQuery object? --- Is through the generation jQuery object package DOM object. jQuery jQuery object is unique, it can use jQuery in the method. For example: $ ("# Test"). Html () means: to get the element ID for the test within the htm