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 Descriptive Programming inline


Apart from storing TOs in OR, UFT supports using Inline Descriptions (ID), a technique also generally known as Descriptive Programming (DP). As these descriptions are strings, the technique allows for parameterization, and runtime and dynamic identification of objects using data that was predefined or retrieved from AUT during the run session.

Getting ready

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

How to do it...

Suppose that we need to identify an object like one of the links on the Google search engine, such as YouTube, then click on it, and navigate back to Google.

Proceed with the following steps:

  1. If we know the values for identification properties (which we can obtain using the UFT Spy), then we can easily write code to accomplish this as follows:

    with Browser("micclass:=Browser", "title:=Google").Page("title:=Google").Link("html tag:=A","innertext:=YouTube")
        If .exist(0) Then
            .highlight
            .click
        End...