Document Object Model
Web pages typically consist of graphics and text written in HTML. Web pages may also use other scripted languages such as Java, JavaScript, Common Gateway Interface (CGI), and Visual Basic script. To view the HTML source code for a Web page, right-click the Web page, and then click View Source.
Quickest provides direct access to the Internet Explorer's Document Object Model (DOM) through which you can access the HTML tags directly. Access to the DOM is performed using the .Object notation. With DOM, QTP can access the Source of a Webpage.
Example:
1. Launch URL "http://www.mortgagecalculator.org/"
Web pages typically consist of graphics and text written in HTML. Web pages may also use other scripted languages such as Java, JavaScript, Common Gateway Interface (CGI), and Visual Basic script. To view the HTML source code for a Web page, right-click the Web page, and then click View Source.
Quickest provides direct access to the Internet Explorer's Document Object Model (DOM) through which you can access the HTML tags directly. Access to the DOM is performed using the .Object notation. With DOM, QTP can access the Source of a Webpage.
Example:
1. Launch URL "http://www.mortgagecalculator.org/"
2. Now Right click on the page and select View source
3. Highlighted are the Lines in Source pertaining to the Field in application.
4. With Dom you can Access the Tags for the Webedit and enter value “QTP” in it.
QTP Code
' Add browser and Page object to repositry
Set Parent = Browser("Mortgage Calculator").Page("Mortgage Calculator")
Set obj = Parent.Object.getElementsByTagName("input")
inCount=obj.Length-1
For i=0 to inCount
If obj(i).Name="param[homevalue]" and obj(i).Type="text" Then
obj(i).Value="QTP"
End If
Next
5. The Webedit Field is populated with value "QTP"
No comments:
Post a Comment