Book Image

Advanced UFT 12 for Test Engineers Cookbook

Book Image

Advanced UFT 12 for Test Engineers Cookbook

Overview of this book

Table of Contents (18 chapters)
Advanced UFT 12 for Test Engineers Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Using child objects


In the previous recipe, you have learned about using the Description object. This recipe will show you how to get a collection of runtime objects and perform checkpoints to verify the values of specific properties. In our example, we will describe how to retrieve images from a web page, and then perform a check operation using a Checkpoint object that we would store beforehand in OR.

How to do it...

Proceed with the following steps:

  1. We will create a Description object and then define the appropriate property-value pairs for identification, as follows:

    Dim oDesc, i, oImgCollection
    
    Set oDesc=Description.Create
    oDesc("html tag").value="IMG|img"
    oDesc("html tag").RegularExpression = true
  2. The following statement will retrieve a collection of images from the Google page:

    set oImgCollection=Browser("title:=Google").Page("title:=Google").ChildObjects(oDesc)
  3. With this collection, we can now implement a loop that uses our Checkpoint object to validate the required properties:

    For i =...