Implementing FindObjectId or FindObjectID2: Map a Description to an Object ID

When UFT One needs to locate an object in the application based on the description stored in the test (for example, when running a test), UFT One calls FindObjectId2 with the stored description. The method returns the object IDs for all objects that match the description. This enables UFT One to use Smart Identification (if the UFT One user configures it) to single out the appropriate object. For more information, see Smart Identification.

If the requested object is not found, UFT One calls FindObjectId2 repeatedly until a time out is reached, to accommodate cases in which the object takes a few seconds to load.

The description that UFT One passes to FindObjectId2 can include regular expressions defined by the UFT One user. You must implement the FindObjectId2 method to handle regular expression, if necessary, to locate the object that matches the description. For more information on using regular expressions in UFT One, see the UFT One User Guide.

FindObjectId2 is defined in interface ITestable2. This method replaces ITestable.FindObjectId and adds the functionality of finding multiple matches and handling regular expressions.

If you do not implement ITestable2, UFT One calls ITestable.FindObjectId. In this case, the added functionalities are not available. If you do implement ITestable2, UFT One always calls ITestable2::FindObjectId2, without checking whether ITestable.FindObjectId exists.