FlexTable Object
Note: Following the retirement of the Adobe Flash Player, UFT One no longer supports the Flex Add-in out of the box.
If you require the Flex Add-in, contact OpenText Support.
Description
A Flex data grid control.
Operations
The sections below list the built-in methods and properties that you can use as operations for the FlexTable object.
Note: You can also view a list and descriptions of the FlexTable description properties, for use in object repository descriptions, programmatic descriptions, checkpoint and output value steps, and as argument values for the GetTOProperty and GetROProperty methods.
Methods
ActivateColumn | Clicks the header of the specified column in the table. |
ActivateCell | Double-clicks the specified cell in the grid. |
CaptureBitmap | Saves a screen capture of the object as a .png or .bmp image using the specified file name. |
Check | Checks whether the actual value of an item matches the expected value. |
CheckProperty | Checks whether the actual value of the specified object property matches the specified expected value within the specified timeout. |
ChildObjects | Returns the collection of child objects contained within the object. |
GetAllROProperties | Returns the collection of properties and current values from the object in the application. |
Click | Clicks an object. |
CollapseRow | Collapses a row in the table. |
DblClick | Double clicks an object. |
DeselectRow | Deselects the specified row in the table. |
ExpandRow | Expands a row in the table. |
ExtendRow | Selects an additional row in the table. |
GetCellChildObjects | Returns the collection of child objects contained within the specified table cell. |
GetCellData | Retrieves the contents of the specified cell from the table. |
GetColumnName | Returns the name of column specified by index. |
GetROProperty | Returns the current value of the description property from the object in the application. |
GetTOProperties | Returns the collection of properties and values used to identify the object. |
GetTOProperty | Returns the value of the specified description property from the test object description. |
Highlight | Highlights the object in the application. |
Output | Retrieves the current value of an item and stores it in a specified location. |
RefreshObject | Instructs UFT One to re-identify the object in the application the next time a step refers to this object. |
SelectCell | Selects the specified cell in the table. |
SelectRow | Selects the specified row in the table. |
SelectRowsRange | Selects the specified range of rows in the table. |
SetCellData | Sets the contents of a cell to the specified text. |
SetTOProperty | Sets the value of the specified description property in the test object description. |
SortByColumn | Sorts an AdvancedDataGrid according to the selected column, in addition to any previous sorting. |
ToString | Returns a string that represents the test object. |
WaitProperty | Waits until the specified object property achieves the specified value or exceeds the specified timeout before continuing to the next step. |
Properties
Exist | Checks whether the object currently exists in the open application. |
ActivateColumn Method
Description
Clicks the header of the specified column in the table.
Syntax
object.ActivateColumn (col)
Arguments
Parameter | Description |
---|---|
col |
Required. A Variant. The name (with quotes) or index (without quotes) of the column to select. Index values begin with 0. For columns with complex names, for example, if the column header contains an icon, use the column index. Alternatively, retrieve the column header from the parameter dataField in DataGridColumn, and use that name to specify the column. |
Return Type
None.
IMPORTANT
- When recording operations on columns, UFT One records the column name value for the col argument if the column name has a value and that value is unique among the names of the columns in the table. Otherwise UFT One records the column index.
- For an AdvancedDataGrid control, you can use the SortByColumn Method to sort by multiple columns.
Example
'The following example uses the ActivateColumn method to sequentially 'activate the first column, and then the column named Phone, in the 'FlexTable grid. With Browser("Browser").Page("Page").FlexWindow("AllControls") .FlexTable("FlexTable").ActivateColumn 0 .FlexTable("FlexTable").ActivateColumn "Phone" End With
ActivateCell Method
Description
Double-clicks the specified cell in the grid.
Syntax
object.ActivateCell (row, col, [X] , [Y], [Button])
Arguments
Parameter | Description |
---|---|
row |
Required. A long integer value. The index of the row where the cell is located. Index values begin with 0. |
col |
Required. A Variant. The name (with quotes) or index (without quotes) of the column where the cell is located. Index values begin with 0. For columns with complex names, for example, if the column header contains an icon, use the column index. Alternatively, retrieve the column header from the parameter dataField in DataGridColumn, and use that name to specify the column. |
X | Optional. An integer value. The X-coordinate of the cell. Default value: micLeftBtn |
Y | Optional. An integer value. The y-coordinate of the cell. Default value: micLeftBtn |
Button | Optional. A string. The button used to double-click the specified cell. Default value = micLeftBtn |
Return Type
None
IMPORTANT
This method is supported only for running tests.
Click Method
Description
Clicks an object.
Syntax
object.Click ([X], [Y], [BUTTON])
Arguments
Parameter | Description |
---|---|
X |
Optional. An integer value. The x-coordinate of the click. Note that the specified coordinates are relative to the upper left corner of the object. The default value is the center of the object. Default value = -9999 |
Y |
Optional. An integer value. The y-coordinate of the click. Note that the specified coordinates are relative to the upper left corner of the object. The default value is the center of the object. Default value = -9999 |
BUTTON |
Optional. A predefined constant or number. The mouse button used to click the object. Default value = micLeftBtn |
Return Type
None.
Example
'The following example uses the Click method to click 'the OK button, at coordinates 15,20. With Browser("Browser").Page("Page").FlexWindow("AllControls") .FlexButton("OK").Click 15, 20, micLeftBtn End With
DblClick Method
Description
Double clicks an object.
Syntax
object.Click ([X], [Y], [BUTTON])
Arguments
Parameter | Description |
---|---|
X |
Optional. An integer value. The x-coordinate of the click. Note that the specified coordinates are relative to the upper left corner of the object. The default value is the center of the object. Default value = -9999 |
Y |
Optional. An integer value. The y-coordinate of the click. Note that the specified coordinates are relative to the upper left corner of the object. The default value is the center of the object. Default value = -9999 |
BUTTON |
Optional. A predefined constant or number. The mouse button used to click the object. Default value = micLeftBtn |
Return Type
None.
Example
'The following example uses the Click method to click 'the OK button, at coordinates 15,20. With Browser("Browser").Page("Page").FlexWindow("AllControls") .FlexButton("OK").DblClick 15, 20, micLeftBtn End With
CollapseRow Method
Description
Collapses a row in the table.
Syntax
object.CollapseRow (row)
Arguments
Parameter | Description |
---|---|
row |
Required. A long integer value. The index of the row to collapse. Index values begin with 0. |
Return Type
None.
IMPORTANT
This method is relevant only for AdvancedDataGrid controls.
Example
'The following example uses the CollapseRow method to collapse 'the third row in the FlexTable grid. With Browser("Browser").Page("Page").FlexWindow("AllControls") .FlexTable("FlexTable").CollapseRow 2 End With
DeselectRow Method
Description
Deselects the specified row in the table.
Syntax
object.DeselectRow (row)
Arguments
Parameter | Description |
---|---|
row |
Required. A long integer value. The index of the row to deselect. Index values begin with 0. |
Return Type
None.
Example
'The following example uses the DeselectRow method to clear the 'selection of the third row in the FlexTable grid. With Browser("Browser").Page("Page").FlexWindow("AllControls") .FlexTable("FlexTable").DeselectRow 2 End With
ExpandRow Method
Description
Expands a row in the table.
Syntax
object.ExpandRow (row)
Arguments
Parameter | Description |
---|---|
row |
Required. A long integer value. The index of the row to expand. Index values begin with 0. |
Return Type
None.
IMPORTANT
This method is relevant only for AdvancedDataGrid controls.
Example
'The following example uses the ExpandRow method to expand the 'third row in the FlexTable grid. With Browser("Browser").Page("Page").FlexWindow("AllControls") .FlexTable("FlexTable").ExpandRow 2 End With
ExtendRow Method
Description
Selects an additional row in the table.
Syntax
object.ExtendRow (row)
Arguments
Parameter | Description |
---|---|
row |
Required. A long integer value. The index of the row to select. Index values begin with 0. |
Return Type
None.
IMPORTANT
This method is relevant only for tables that support selecting multiple rows.
Example
'The following example uses the ExtendRow method to extend the 'selection to the third row in the FlexTable grid. With Browser("Browser").Page("Page").FlexWindow("AllControls") .FlexTable("FlexTable").ExtendRow 2 End With
GetCellChildObjects Method
Description
Returns the collection of child objects contained within the specified table cell.
Syntax
object.GetCellChildObjects (row, col, [Description])
Arguments
Parameter | Description |
---|---|
row |
Required. A long integer value. The index of the row where the cell is located. Index values begin with 0. |
col |
Required. A Variant. The name (with quotes) or index (without quotes) of the column where the cell is located. Index values begin with 0. For columns with complex names, for example, if the column header contains an icon, use the column index. Alternatively, retrieve the column header from the parameter dataField in DataGridColumn, and use that name to specify the column. |
Description |
Optional. An Object. The Properties (collection) object containing the description of the child objects you want to retrieve. Tip: You can retrieve a Properties collection using the GetTOProperties method or you can build a Properties collection object using the Description object. For more information on the Description object, refer to the Utility Objects section of the UFT One Object Model Reference. |
Return Type
An Object.
A collection of test objects. The collection can be empty, or contain one or more objects, depending on the number of relevant child objects found.
IMPORTANT
- Use this method to access objects that are embedded inside of Flex table cells, such as check boxes, radio buttons, and toggle buttons.
- You may want to call the SelectCell method to activate the cell before accessing its content, as this sometimes changes the embedded objects.
- The GetCellChildObjects method returns a cell's child objects only if the cell is visible. To make sure the cell is visible before calling this method, use the SelectCell or SelectRow methods.
- The GetCellChildObjects method may not return a child object for plain text contained in a table cell. To retrieve or set this type of data, use the GetCellData or SetCellData methods.
Example
'The following example uses the GetCellChildObjects method to retrieve the objects 'contained in the cell located in the first row of the first column in the 'FlexTable grid, and then prints the objects in a numbered list. 'First, click the cell to activate it and show the controls it contains Browser("Browser").Page("Page").FlexWindow("AllControls").FlexTable("FlexTable") .SelectCell(0,0) Wait(1) 'Next, retrieve the child test objects Set collection = Browser("Browser").Page("Page").FlexWindow("AllControls") .FlexTable("FlexTable").GetCellChildObjects(0, 0) Print collection.Count For Iterator = 0 To collection.Count-1 Step 1 Print Iterator & ":" & collection(Iterator).ToString Next
GetCellData Method
Description
Retrieves the contents of the specified cell from the table.
Syntax
object.GetCellData (row, col)
Arguments
Parameter | Description |
---|---|
row |
Required. A long integer value. The index of the row where the cell is located. Index values begin with 0. |
col |
Required. A Variant. The name (with quotes) or index (without quotes) of the column where the cell is located. Index values begin with 0. For columns with complex names, for example, if the column header contains an icon, use the column index. Alternatively, retrieve the column header from the parameter dataField in DataGridColumn, and use that name to specify the column. |
Return Type
A String value.
Example
'The following example uses the GetCellData method to retrieve 'the data contained in the cell located in the first row of the 'first columnn, and then in the cell located in the first row 'of the column named Name, in the FlexTable grid. With Browser("Browser").Page("Page").FlexWindow("AllControls") ID = .FlexTable("FlexTable").GetCellData(0, 0) MsgBox (ID) Name = .FlexTable("FlexTable").GetCellData(0, "Name") MsgBox (Name) End With
GetColumnName Method
Description
Returns the name of column specified by index.
Syntax
object.GetColumnName (col)
Arguments
Parameter | Description |
---|---|
col |
Required. A long integer value. The index (without quotes) of the column where the cell is located. Index values begin with 0. |
Return Type
A String value.
IMPORTANT
For columns with complex names, for example, if the column header contains an icon, the method returns the column header from the parameter dataField in the DataGridColumn.
Example
'The following example retrieves the column name of the third column in a FlexTable. Browser("Browser").Page("Page").FlexWindow("AllControls").FlexTable("FlexTable").GetColumnName 2
SelectCell Method
Description
Selects the specified cell in the table.
Syntax
object.SelectCell (row, col, [X], [Y])
Arguments
Parameter | Description |
---|---|
row |
Required. A long integer value. The index of the row where the cell is located. Index values begin with 0. |
col |
Required. A Variant. The name (with quotes) or index (without quotes) of the column where the cell is located. Index values begin with 0. For columns with complex names, for example, if the column header contains an icon, use the column index. Alternatively, retrieve the column header from the parameter dataField in DataGridColumn, and use that name to specify the column. |
X |
Optional. An integer value. The x-coordinate of the location to click when selecting the cell. Note that the specified coordinates are relative to the upper left corner of the cell. The default is the center of the cell. Default value = -9999 |
Y |
Optional. An integer value. The y-coordinate of the location to click when selecting the cell. Note that the specified coordinates are relative to the upper left corner of the cell. The default is the center of the cell. Default value = -9999 |
Return Type
None.
IMPORTANT
- If the table cell contains embedded objects and you want to avoid clicking them when selecting the cell, provide the x and y arguments to specify a location to click inside the cell.
- This method is also useful for bringing the cell into view. For example, before calling GetCellChildObjects.
Example
'The following example iterated through the table and uses the SelectCell method 'to click each cell in the table. For row = 0 To 2 Step 1 For column = 0 To 3 Step 1 Browser("Browser").Page("Page").FlexWindow("AllControls") .FlexTable("Colors").SelectCell row, column Wait(1) Next Next
SelectRow Method
Description
Selects the specified row in the table.
Syntax
object.SelectRow (row, [X], [Y])
Arguments
Parameter | Description |
---|---|
row |
Required. A long integer value. The index of the row to select. Index values begin with 0. |
X |
Optional. A long integer value. The x-coordinate of the location to click when selecting the row. Note that the specified coordinates are relative to the upper left corner of the row. The default is the center of the row. Default value = -9999 |
Y |
Optional. A long integer value. The y-coordinate of the location to click when selecting the row. Note that the specified coordinates are relative to the upper left corner of the row. The default is the center of the row. Default value = -9999 |
Return Type
None.
IMPORTANT
- If the table cells contain embedded objects and you want to avoid clicking them when selecting the row, provide the x and y arguments to specify a location to click inside the row.
- This method is also useful for bringing the row into view. For example, before calling GetCellChildObjects.
Example
'The following example uses the SelectRow method to select 'the first row in the FlexTable grid. With Browser("Browser").Page("Page").FlexWindow("AllControls") .FlexTable("FlexTable").SelectRow 0 End With
SelectRowsRange Method
Description
Selects the specified range of rows in the table.
Syntax
object.SelectRowsRange (FirstRow, LastRow)
Arguments
Parameter | Description |
---|---|
FirstRow |
Required. A long integer value. The index of the first row in the range of rows to select. Index values begin with 0. |
LastRow |
Required. A long integer value. The index of the last row in the range of rows to select. Index values begin with 0. |
Return Type
None.
IMPORTANT
This method is relevant only for tables that support selecting multiple rows.
Example
'The following example uses the SelectRowsRange method to select 'a range of four rows in the FlexTable grid. With Browser("Browser").Page("Page").FlexWindow("AllControls") .FlexTable("FlexTable").SelectRowsRange 3,6 End With
SetCellData Method
Description
Sets the contents of a cell to the specified text.
Syntax
object.SetCellData (row, col, text)
Arguments
Parameter | Description |
---|---|
row |
Required. A long integer value. The index of the row where the cell is located. Index values begin with 0. |
col |
Required. A Variant. The name (with quotes) or index (without quotes) of the column where the cell is located. Index values begin with 0. For columns with complex names, for example, if the column header contains an icon, use the column index. Alternatively, retrieve the column header from the parameter dataField in DataGridColumn, and use that name to specify the column. |
text |
Required. A String value. The contents to be entered into the specified cell. |
Return Type
None.
IMPORTANT
When recording operations on columns, UFT One records the column name value for the col argument if the column name has a value and that value is unique among the names of the columns in the table. Otherwise UFT One records the column index.
Example
'The following example uses the SetCellData method to modify 'the value of the cell located in the first row of the first 'column, and then the cell located in the first row of the 'column named Phone, in the FlexTable grid. With Browser("Browser").Page("Page").FlexWindow("AllControls") .FlexTable("FlexTable").SetCellData 0, 0, "01589006" .FlexTable("FlexTable").SetCellData 0, "Phone", "150-34-76" End With
SortByColumn Method
Description
Sorts an AdvancedDataGrid according to the selected column, in addition to any previous sorting.
Syntax
object.SortByColumn (col)
Arguments
Parameter | Description |
---|---|
col |
Required. A Variant. The name (with quotes) or index (without quotes) of the column to select. Index values begin with 0. For columns with complex names, for example, if the column header contains an icon, use the column index. Alternatively, retrieve the column header from the parameter dataField in DataGridColumn, and use that name to specify the column. |
Return Type
None.
IMPORTANT
- This method is relevant only for AdvancedDataGrid controls.
- If you sort by a column that is already sorted, its sort order is reversed.
- Sorting by a column is equivalent to clicking on the right side of the column header (or, for tables defined with the sortExpertMode property set to true, holding the CTRL key and clicking the column header).
Example
'The following example uses the SortByColumn method to sort the AdvancedDataGrid table 'according to the first column, and then additionally sort by the column named ' Status. With Browser("Browser").Page("Page").FlexWindow("AllControls") .AdvancedDataGrid("FlexTable").SortByColumn 0 .AdvancedDataGrid("FlexTable").SortByColumn "Status" End With
See also: