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

Resolving file locations (PathFinder)


The PathFinder object is useful to find a file or folder in the folders listed in the UFT search list. The method Locate returns a string with the path found. Other methods, which are rather undocumented, can be used to manage the list of search folders using code, but they are beyond the scope of this book.

Getting ready

From the File menu, navigate to New | Test, or use the Ctrl + N shortcut. In the Tools menu, select Options. In the dialog that opens, navigate to GUI Testing | Folders and add one folder or more to the search list.

How to do it…

To get the path of a file, use the following syntax:

sFilePathname = PathFinder.Locate("MyFile.txt")

How it works…

The PathFinder.Locate method will search through the folders listed in the search list according to their order and, if found, return the full pathname. It will return the first instance found. This means, if more than one file with the searched name exists in the several folders, the method will proceed...