AITableCell Object
This object is supported as a technical preview.
Description
An internal object used to perform operations on a table cell identified using AI.
AITableCell objects are containers. You can access the specific controls inside the AITableCell container and perform operations directly on them.
IMPORTANT
AITableCells are supported on the following technologies:
Web and SAP GUI for Windows.
AI objects are supported in UFT One only when:
- The UFT One Web Add-in or SAP Solutions Add-in is installed and loaded.
- The UFT One AI Features are installed and AI is enabled in the UFT One options. For details, see the UFT One Help Center.
To retrieve an AITableCell object, use the AITable.Cell property.
Table cell objects are identified using ABBYY OCR. To use AITableCell objects, you must have the ABBYY OCR Engine feature installed in UFT One.
Operations
The sections below list the built-in methods and properties that you can use as operations for the AITableCell object.
Note: You can also view a list and descriptions of the AITableCell properties that you can retrieve using the GetObjectProperty and GetAllProperties methods. You can then use the properties to check the object's location or content.
Methods
CaptureBitmap | Saves a screen capture of the object as a .png or .bmp image using the specified file name. |
CheckExists | A checkpoint that checks whether the object currently exists in the set context. |
Click | Clicks the cell. |
DoubleClick | Double-clicks the AI text object. |
GetAllProperties | Retrieves all of the AITableCell's properties and their values from the application. |
GetObjectProperty | Retrieves the value of the specified object property from the table cell in the application. |
GetText | Retrieves the cell's text. |
Highlight | Highlights the object in the application. |
LongClick | Presses and holds the AI text object for a specified number of seconds. |
MultiClick | Clicks the AI text object the specified number of times. |
RightClick | Right-clicks the AI text object. |
SetText | Sets the value of the cell. Relevant for cells containing text boxes, input controls, and combo boxes. |
SetTextSecure | Sets the encoded value of the cell. Relevant for cells containing text boxes, input controls, and combo boxes. |
Type | Types the specified string in the current cell. |
TypeSecure | Types the specified encoded string in the current cell. |
Properties
AIObject | Creates an AIObject for the specified control found inside the container. |
Exist | Checks whether the object currently exists in the set context. |
FindText | Creates an AITextObject for the specified text found inside the container. |
FindTextBlock | Creates an AITextObject for the specified text block found inside the container. |
CaptureBitmap Method
Description
Saves a screen capture of the object as a .png or .bmp image using the specified file name.
Syntax
AIUtil.Table.Cell(Row, Column).CaptureBitmap FullFileName, [OverrideExisting]
Arguments
Parameter | Description |
---|---|
FullFileName | Required. A String value. The path to the file to store the screen capture. The file extension indicates whether to save the capture as a .png or .bmp file. |
OverrideExisting | Optional. A Boolean value. Indicates what to do if a file by the specified name already exists: True: Replace the existing file with the new capture. False (Default): The step fails if a file by the specified name already exists. |
Return Type
None
Examples
'The following example uses the CaptureBitmap method to capture an image of cell (1,2) in
' a table currently open in the browser.
AIUtil.SetContext Browser("creationtime:=0")
AIUtil.Table(micFromTop, 2).Cell(1, 2).CaptureBitmap "c:\tablecell.bmp"
CheckExists Method
Description
A checkpoint that checks whether the object currently exists in the set context.
Syntax
AIUtil.Table.Cell(Row, Column).CheckExists expected
Arguments
Parameter | Description |
---|---|
expected | A Boolean value. Specifies whether this checkpoint expects the object to exist. Possible values: true. The checkpoint passes if the object is found within the set context before the timeout expires. false. The checkpoint passes if the object is not found by the time the timeout expires. |
Remarks
This method uses the timeout defined in the Object Synchronization Timeout option in the Run pane of the Test Settings dialog box.
UFT One directly performs this method without verifying object identification even if you enable it in Options > GUI Testing > AI or use the AIUtil.RunSettings.VerifyIdentification.Enable step.
Return Type
A Boolean value.
Returns TRUE if the checkpoint passes, otherwise FALSE.
A TRUE return value reports a Passed step to the run results; a FALSE return value reports a Failed step to the run results.
Example
'This function clicks a button that opens a table and then makes sure a cell in the table exists
AIUtil.SetContext Browser ("title:=.*")
AIUtil("button", "Open table").Click
AIUtil.Table(micFromTop, 3).Cell(3, "Price").CheckExists True
objExist = AIUtil.Table(micFromTop, 3).Cell(3, 4).Exist
if(objExist) then
Print("Cell exists"End If
Click Method
Description
Clicks the cell.
Syntax
AIUtil.Table.Cell(Row, Column).Click
Return Type
None
Example
Print AIUtil.Table.Cell(2, "Price").GetText
DoubleClick Method
Description
Double-clicks the cell.
Syntax
AIUtil.Table.Cell(Row, Column).DoubleClick [x], [y]
Arguments
Parameter | Description |
---|---|
x |
Optional. An integer value. The x-coordinate of the double-click. Note that the specified coordinates are relative to the upper left corner of the object. The default value is the middle of the object (-9999). |
y |
Optional. An integer value. The y-coordinate of the double-click. Note that the specified coordinates are relative to the upper left corner of the object. The default value is the middle of the object (-9999). |
Return Type
None
IMPORTANT
The DoubleClick method is not supported on mobile applications.
Example
'The following example double-clicks the 10,10 point in the cell.
AIUtil.SetContext Browser("creationtime:=0")
AIUtil.Table.Cell(2, "Price").DoubleClick 10, 10
GetAllProperties Method
Description
Retrieves all of the AITableCell's properties and their values from the application.
Syntax
AIUtil.Table.Cell(Row, Column).GetAllProperties
Return Type
A Dictionary object
Example
'The following example retrieves the properties of an AITableCell and prints them.
AIUtil.SetContext Browser("creationtime:=0") 'Set the context for AI
Set properties = AIUtil.Table.Cell(2, "Price").GetAllProperties
For i = 0 To properties.count - 1
print properties.keys()(i) & ":" & properties.items()(i)
Next
'Print just one of the retrieved properties.
print "height:'" & properties("height") & "'"
GetObjectProperty Method
Description
Retrieves the value of the specified object property from the table cell in the application.
Syntax
AIUtil.Table.Cell(Row, Column).GetObjectProperty (property)
Arguments
Parameter | Description |
---|---|
property | Required. A String. The name of the property whose value to return. |
Return Type
A Variant.
Example
'The following example retrieves the height property of an AITableCell and prints it.
AIUtil.SetContext Browser("creationtime:=0") 'Set the context for AI
print "height:'" & AIUtil.Table.Cell(2, "Price").GetObjectProperty ("height") & "'"
GetText Method
Description
Retrieves the cell's text.
Syntax
AIUtil.Table.Cell(Row, Column).GetText
Return Type
None
Example
AIUtil.SetContext Browser("creationtime:=0")
AIUtil.Table.Cell(2, "Price").Click
Print AIUtil.Table.Cell(2, "Price").GetText
'This example traverses all cells of a table and prints their text
'Setting the Table into a variable improves performance because the table is only located once
'Do not do this if the table's location changes while it is used
Set Table = AIUtil.Table
Rows = Table.VisibleRowCount
Columns = Table.VisibleColumnCount
For Row = 0 To Rows - 1
For Column = 0 To Columns - 1
Print Table.Cell(Row, Column).GetText
Next
Next
Highlight Method
Description
Highlights the object in the application.
Syntax
AIUtil.Table.Cell(Row, Column).Highlight
Return Type
None
Example
'The following example draws a rectangle that flashes for a second around the identified cell
AIUtil.SetContext Browser("MyBrowser") 'Set the context for AI
AIUtil.Table.Cell(2, "Price").Highlight
LongClick Method
Description
Presses and holds the cell for a specified number of seconds.
Syntax
AIUtil.Table.Cell(Row, Column).LongClick [duration], [x], [y]
Arguments
Parameter | Description |
---|---|
duration | Optional. A double float value. The number of seconds to press the object. Default: 2 seconds |
x |
Optional. An integer value. The x-coordinate of the long click. Note that the specified coordinates are relative to the upper left corner of the object. The default value is the middle of the object (-9999). |
y |
Optional. An integer value. The y-coordinate of the long click. Note that the specified coordinates are relative to the upper left corner of the object. The default value is the middle of the object (-9999). |
Return Type
None
Example
'The following example long-clicks the 'Price' cell in row #2 for 1.5 seconds.
AIUtil.SetContext Browser("MyBrowser") 'Set the context for AI
AIUtil.Table.Cell(2, "Price").LongClick 1.5
MultiClick Method
Description
Clicks the cell the specified number of times.
Syntax
AIUtil.Table.Cell(Row, Column).MultiClick [numberOfClicks ], [interval], [x], [y]
Arguments
Parameter | Description |
---|---|
numberOfClicks | Required. An integer value. The number of times to click. |
interval | Optional. A double floating value. The number of seconds between clicks. The default value is 0.5 seconds. |
x |
Optional. An integer value. The x-coordinate of the clicks. Note that the specified coordinates are relative to the upper left corner of the object. The default value is the middle of the object (-9999). |
y |
Optional. An integer value. The y-coordinate of the clicks. Note that the specified coordinates are relative to the upper left corner of the object. The default value is the middle of the object (-9999). |
Return Type
None
Example
'The following example clicks the 'Price' cell in row #2 three times,
'with half a second between each click
AIUtil.SetContext Device("device") 'Set the context for AI
AIUtil.Table.Cell(2, "Price").MultiClick 3
RightClick Method
Description
Right-clicks the cell.
Syntax
AIUtil.Table.Cell(Row, Column).RightClick [x], [y]
Arguments
Parameter | Description |
---|---|
x |
Optional. An integer value. The x-coordinate of the long click. Note that the specified coordinates are relative to the upper left corner of the object. The default value is the middle of the object (-9999). |
y |
Optional. An integer value. The y-coordinate of the long click. Note that the specified coordinates are relative to the upper left corner of the object. The default value is the middle of the object (-9999). |
Return Type
None
IMPORTANT
The RightClick method is not supported on mobile applications.
Example
'The following example right-clicks the 'Price' cell in row #2.
AIUtil.SetContext Browser("MyBrowser") 'Set the context for AI
AIUtil.Table.Cell(2, "Price").RightClick
SetText Method
Description
Sets the value of the cell.
Syntax
AIUtil.Table.Cell(Row, Column).SetText [text]
Arguments
Parameter | Description |
---|---|
text |
Required. A String value. The string to set in the cell. |
Return Type
None
IMPORTANT
This method is relevant for cells that contain text boxes, input controls, and combo boxes.
This method is not supported for mobile applications.
Example
'The following example enters the user name in the table cell.
AIUtil.SetContext Browser("MyBrowser") 'Set the context for AI
AIUtil.Table.Cell(2, "USER NAME").SetText "MyName"
SetTextSecure Method
Description
Sets the encoded value of the cell.
Syntax
AIUtil.Table.Cell(Row, Column).SetTextSecure [encodedText]
Arguments
Parameter | Description |
---|---|
encodedText |
Required. A String value. The encoded string to set in the cell. |
Return Type
None
IMPORTANT
This method is relevant for cells that contain text boxes, input controls, and combo boxes.
This method is not supported for mobile applications.
To find the encoded value to use as the argument for the SetTextSecure method, do one of the following:
Use the Password Encoder utility (available from the Windows Start menu).
Parameterize the argument and use the Data Table encryption option (right-click each unencrypted value in the password column and choose Data > Encrypt).
For more information, see the UFT One Help Center.
Note: While the SetTextSecure method enables you to hide passwords on the screen when running a test, it is not intended to be a secure way to protect password information.
Example
'The following example enters an encoded password in the table cell.
AIUtil.SetContext Browser("MyBrowser") 'Set the context for AI
AIUtil.Table.Cell(2, "PASSWORD").SetTextSecure "5cfe0d56013bbd8b5742b597cadc92352a6c"
Type Method
Description
Types the specified string in the current cell.
Syntax
AIUtil.Table.Cell(Row, Column).Type [text]
Arguments
Parameter | Description |
---|---|
text |
Required. A String value. The string to type. |
Return Type
None
Example
AIUtil.SetContext Browser ("title:=.*")
AIUtil.Table(micFromTop, 3).Cell(3, "Price").Type "hello"
TypeSecure Method
Description
Types the specified encoded string in the current cell.
Syntax
AIUtil.Table.Cell(Row, Column).TypeSecure [text]
Arguments
Parameter | Description |
---|---|
text |
Required. A String value. The encrypted string to type. |
Return Type
None
IMPORTANT
To find the encoded value to use as the argument for the TypeSecure method, do one of the following:
Use the Password Encoder utility (available from the Windows Start menu).
Parameterize the argument and use the Data Table encryption option (right-click each unencrypted value in the password column and choose Data > Encrypt).
For more information, see the UFT One Help Center.
While the TypeSecure method enables you to hide passwords on the screen when running a test, it is not intended to be a secure way to protect password information.
Example
'The following example types an encoded string in the table cell.
AIUtil.SetContext Browser ("title:=.*")
AIUtil.Table(micFromTop, 3).Cell(3, "Price").TypeSecure "5cfe0d56013bbd8b5742b597cadc92352a6c"
AIObject Property
Description
Creates an AIObject Object for the specified control. The control can be specified by type, and for some control types, by the object text.
If there are multiple similar objects in the cell, use the object's relative location in the cell to describe it uniquely.
Syntax
AIUtil.Table.Cell(Row, Column).AIObject ControlType, [AIText], [locator], [locatorData]
Arguments
Parameter | Description |
---|---|
ControlType |
Required. A String value. The type of the control. For a list of supported control types, see the UFT One Help Center. |
AIText |
Optional. A String value. |
locator | Optional. A predefined constant or string value. Mandatory if you specify a value for the locatorData parameter. Used to describe the unique location of an object that may appear multiple times in the cell. The location can be ordinal, relative to similar objects in the cell, or proximal, relative to a different AI object, considered an anchor.
|
locatorData | Optional. An Integer value or an AI object. Mandatory if you specify a value for the locator parameter.
|
Return Type
An AIObject Object.
Example
'The following example draws a rectangle that flashes for a second around the identified check box
AIUtil.SetContext Browser("MyBrowser") 'Set the context for AI
AIUtil.Table.Cell(2, "Status").AIObject("check box").Highlight
Exist Property
Description
Checks whether the object currently exists in the set context.
Syntax
AIUtil.Table.Cell(Row, Column).Exist([TimeOut])
Arguments
Parameter | Description |
---|---|
TimeOut | Optional. An unsigned long integer value. The length of time (in seconds) to search for the object before returning a True or False value.
Note: A value of 0 is not supported for Mobile test objects. For more information on the Object Synchronization Timeout, see the UFT One Help Center. |
Return Type
A Boolean value indicating whether the object exists.
Remarks
The Exist property can only be used in statements that use its return value. For example, assignment, print, and if statements.
UFT One directly performs this method without verifying object identification even if you enable it in Options > GUI Testing > AI or use the AIUtil.RunSettings.VerifyIdentification.Enable step.
Example
AIUtil.SetContext Browser ("title:=.*")
AIUtil("button", "Open table").Click
AIUtil.Table(micFromTop, 3).Cell(3, "Price").CheckExists True
objExist = AIUtil.Table(micFromTop, 3).Cell(3, 4).Exist
if(objExist) then
Print("Cell exists"
End If
FindText Property
Description
Creates an AITextObject Object for the specified text. This may be partial text within a larger block of text.
If there are multiple similar objects in the cell, use the object's relative location in the cell to describe it uniquely.
Syntax
AIUtil.Table.Cell(Row, Column).FindText AIText, [locator], [locatorData]
Arguments
Parameter | Description |
---|---|
AIText |
Required. A String value. Enter the micAnyText constant if you want to ignore this parameter and provide values for locator and locatorData. This is useful when you want to identify an object by its location and later retrieve the text from the object. |
locator | Optional. A predefined constant or string value. Mandatory if you specify a value for the locatorData parameter. Used to describe the unique location of an object that may appear multiple times in the cell. The location can be ordinal, relative to similar objects in the cell, or proximal, relative to a different AI object, considered an anchor.
|
locatorData | Optional. An Integer value or an AI object. Mandatory if you specify a value for the locator parameter.
|
Return Type
Example
'The following example checks that the table summary cell does not display an error
AIUtil.SetContext Browser ("title:=.*")
AIUtil.Table.Cell(0, "status").FindText("error").CheckExists "False"
FindTextBlock Property
Description
Creates an AITextObject Object for the specified text block.
If there are multiple similar objects in the cell, use the object's relative location in the cell to describe it uniquely.
Syntax
AIUtil.Table.Cell(Row, Column).FindTextBlock AIText, [locator], [locatorData]
Arguments
Parameter | Description |
---|---|
AIText |
Required. A String value. Enter the micAnyText constant if you want to ignore this parameter and provide values for locator and locatorData. This is useful when you want to identify an object by its location and later retrieve the text from the object. |
locator | Optional. A predefined constant or string value. Mandatory if you specify a value for the locatorData parameter. Used to describe the unique location of an object that may appear multiple times in the cell. The location can be ordinal, relative to similar objects in the cell, or proximal, relative to a different AI object, considered an anchor.
|
locatorData | Optional. An Integer value or an AI object. Mandatory if you specify a value for the locator parameter.
|
Return Type
Example
'The following example checks that "Good day" is displayed in the table cell
AIUtil.SetContext Browser ("title:=.*")
AIUtil.Table(micFromTop, 3).Cell(2, 2).FindTextBlock("Good day").CheckExists "True"
See also: