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 ...

Get Advanced UFT 12 for Test Engineers Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.