- QTP Tutorial
- QTP - Home
- QTP - Introduction
- QTP - Test Automation
- QTP - Environment Setup
- QTP - Record and Play Back
- QTP - Object Repository
- QTP - Actions
- QTP - DataTables
- QTP - Checkpoints
- QTP - Synchronization
- QTP - Smart Identification
- QTP - Debugging
- QTP - Error Handling
- QTP - Recovery Scenarios
- QTP - Environment Variables
- QTP - Library Files
- QTP - Test Results
- QTP - GUI Objects
- QTP - Virtual Objects
- QTP - Accessing Databases
- QTP - Working with XML
- QTP - Descriptive Programming
- QTP - Automation Object Model
- QTP - Frameworks
- QTP - Designing a Framework
- QTP Useful Resources
- QTP - Questions and Answers
- QTP - Quick Guide
- QTP - Useful Resources
- QTP - Discussion
QTP - Child Objects
The objects (text box, combo box, links) contained in the frame or window is known as child objects. Sometimes, we would be in a situation to get the properties of all the links in a webpage or to get the values of all radio buttons in a window.
In these circumstances, if we want to work on the child objects, we need to use description of objects using which we will be able to work on all the objects in a particular window/page. Descriptive programming will be dealt in detail in the upcoming chapter but the significance of this chapter is to understand child objects and its usage.
The following Script gets the name of the links from the website "www.easycalculation.com"
Dim oDesc Set oDesc = Description.Create oDesc("micclass").value = "Link" 'Find all the Links Set obj = Browser("Math Calculator").Page("Math Calculator").ChildObjects(oDesc) Dim i 'obj.Count value has the number of links in the page For i = 0 to obj.Count - 1 'get the name of all the links in the page x = obj(i).GetROProperty("innerhtml") print x Next
The Result is printed in the output window as shown below −
qtp_object_repository.htm
Advertisements