FindId Method

Applies to TestComplete 15.45, last modified on December 01, 2022

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(Id, RefreshTree)

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.

Remarks

In mobile tests, the identification criteria of the objects that the FindId method returns are based on the internal properties that TestComplete assigns to objects. This differs from the objects you can get by using various FindElement, FindElements, and WaitElements methods. Their identification criteria are based on the accessibility information the tested application provides. This makes the objects got by Find methods and those got by the FindElement, FindElements, and WaitElement methods incompatible.

See Also

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

Highlight search results