ui-automationtestcompleteuia

Using TestComplete's UIAObject with Microsoft UI Automation Control Patterns


In TestComplete, the UIAObject "ControlPatterns" property lists the Microsoft UIA Control Patterns for an object.

General Question : How do you invoke these control patterns against the UIAObject?

Specific Question: How do you get the column header for a DataGridCell given you have the UIAObject?


Solution

  • As far as I know, TestComplete supports patterns for UI Automation objects. The patterns' members are available as the corresponding object's members in TestComplete. You do not need to cast an object to a pattern or invoke a pattern in any other special ways.

    As for your specific question, you can get the index of the column via the column property and then find the corresponding column by this index.

    var dataCellObj = dataGridObj.UIAObject("RowsPresenter").UIAObject("Example_Nutrition_2").UIAObject("DataGridCell");
    var colIndex = dataCellObj.column;
    var column = dataGridObj.UIAObject("ColumnHeadersPresenter").Child(colIndex);
    Log.Message(column.NativeUIAObject.Name);