Welcome to the UFT Testing Extensibility API Reference > UFT Extensibility Agent library 1.3 > Interfaces > ITestable2 Interface > Methods > FindObjectId2 Method
UFT Extensibility Agent library 1.3
FindObjectId2 Method
The Description xml of the object for which the ID is sought. The description may include regular expressions.

The ExternalParent xml of the Windows application object hosting the test object. 

For a stand-alone application or a case where the external parent is not relevant to the testing environment, NULL is passed.

Description
Returns an array of object IDs of the children of the specified parent that match the description. (Implement instead of FindObjectId to support Smart Identification.)
Syntax
Visual Basic
Public Function FindObjectId2( _
   ByVal descriptionXml As String, _
   ByVal externalParent As String _
) As Variant()
Parameters
descriptionXml
The Description xml of the object for which the ID is sought. The description may include regular expressions.
externalParent

The ExternalParent xml of the Windows application object hosting the test object. 

For a stand-alone application or a case where the external parent is not relevant to the testing environment, NULL is passed.

Return Type

A SAFEARRAY containing the object IDs if found, and the HRESULT S_OK.

If no object matches the description, returns the HRESULT E_OBJNOTFOUND and an empty SAFEARRY.

Remarks
  • It is possible to have a non-unique description if a user builds a description manually and uses it in a test, if the application being tested changes during the run, or if the user manually changes properties of the object in the Object Repository.
    Returning more than one object ID enables UFT to use Smart Identification (if configured) to single out the correct object when more than one object matches the description.
    Return object IDs even if the object is not visible.
  • If you Implement the ITestable3 interface, UFT will call this method instead of FindObjectId. Therefore, you must implement this method even if you do not need to support Smart Identification.
See Also