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

Identifying elements based on anchors


In some cases, the same web element is used more than once in a page. For example, suppose that the application uses a toggle button implemented using an image to change the value or the state of other elements, such as input controls (for example, WebEdit). Further, let us assume that these elements possess exactly the same set of attributes, and that they have no unique ID or name to reckon upon for unequivocal identification. In such a case, the task of identifying these objects during runtime can be achieved using alternative options given by UFT, such as the index or location of the object. However, this solution is not robust enough, as I discovered in one of the projects in which I was involved.

The problem was found precisely with such toggle buttons. At first, work was done relying on the index (because the page layout was fixed), but soon I discovered that in some cases, QTP clicked on the wrong button (the project was done in 2007-2008 with...