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 native properties for object identification


With UFT, it is very straightforward to access identification properties using GetROProperty and CheckProperty. However, this limits the scope of what can be checked, as TOs bring many properties that may be required. Fortunately, at least in web applications, we can also use native properties for object identification. In this recipe, we will demonstrate this feature using adapted examples from the previous recipes.

Getting ready

Please ensure that the Internet Explorer application is open on Google.

How to do it...

We will identify the input query WebEdit object using a Description object. In Action, we will put the following code:

Set desc=Description.Create
desc("attribute/nodeName").value="INPUT|input"
desc("attribute/nodeName").RegularExpression = true
desc("attribute/name").value="q"

set oQuery=Browser("title:=Google").Page("title:=Google").WebEdit(desc)

With oQuery
    If .exist(0) Then
        .highlight        
    End If
End With...