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

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

If the requested object is not found, UFT 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 passes to FindObjectId2 can include regular expressions defined by the UFT 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, see the Micro Focus Unified Functional Testing 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 calls ITestable.FindObjectId. In this case, the added functionalities are not available. If you do implement ITestable2, UFT always calls ITestable2::FindObjectId2, without checking whether ITestable.FindObjectId exists.