FindId Method

Applies to TestComplete 14.61, last modified on April 22, 2021

Description

Each object has its unique ID. To get a child object of the current one by the ID of this child object, use the FindID method.

Declaration

TestObj.FindId(IdRefreshTree)

TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
Id [in]    Required    Integer    
RefreshTree [in]    Optional    Boolean Default value: True   
Result Object

Applies To

All processes, windows, controls and onscreen objects.

View Mode

To view this method in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.

Parameters

The method has the following parameters:

Id

Specifies the object ID. The method returns the object that has the same ID.

RefreshTree

TestComplete performs the search in the cached copy of the object hierarchy, which may not correspond to the actual hierarchy of objects in the tested application. This may happen, for instance, if the actions that precedes the search caused changes in the application state. The RefreshTree parameter lets you specify what TestComplete should do if no object matching the search criteria was found in the cached object tree. If it is True (default), TestComplete will refresh the cached object tree and perform the search once again. If it is False, TestComplete will not refresh the object tree and will return a stub object indicating that the search failed.

Result Value

The object that has the specified ID. If no object with that ID was found, the FindID method returns a stub object that only contains the Exists property equal to False. So, you can check the Exists property value of the returned object to determine whether the search was successful.

See Also

Id Property
Find Method
FindEx Method
FindAll Method
FindChild Method
FindChildEx Method
FindAllChildren Method
Child Method
WaitChild Method

Highlight search results