LongTouchCellXY Action (Android Controls)

Applies to TestComplete 15.47, last modified on January 20, 2023
This method is available in legacy mobile tests that work with devices connected to the local computer. To learn how to simulate user actions in newer cloud-compatible mobile tests, see the Simulating user actions in tests section.

Description

The LongTouchCellXY simulates a long touch at the specified point (X, Y), which is relative to the top left corner of the grid cell in the specified row and column.

Declaration

TestObj.LongTouchCellXY(Row, Column, X, Y)

TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
Row [in]    Required    Integer    
Column [in]    Required    Integer    
X [in]    Required    Integer    
Y [in]    Required    Integer    
Result None

Applies To

The method is applied to the following object:

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:

Row

The zero-based index of the row that contains the desired cell. The index is zero-based, that is, the first visible row has index 0, the second - 1, and so on. The index of the last visible row is wRowCount - 1.

Column

Specifies the column (by its index) that contains the desired cell. The index is zero-based, that is, the first column has index 0, the second - 1, and so on. The index of the last column is wColumnCount-1.

X

Specifies the horizontal coordinate of the mouse pointer where long touch will be simulated. The coordinate is relative to the top left corner of the cell.

Y

Specifies the vertical coordinate of the mouse pointer where a long touch will be simulated. The coordinate is relative to the top left corner of the cell.

Result Value

None.

Remarks

If the specified cell is not found LongTouchCellXY fails and posts an error message to the log.

Example

The following example simulates a long touch at the specified point within the grid cell in the specified row and column.

JavaScript, JScript

function Test()
{
  // Select the Android device
  Mobile.SetCurrent("MyDevice");
  // Obtain the tested application
  var app = Mobile.Device().Process("com.example.myapp");
  // Obtain a GridView
  var gridViewObj = app.RootLayout("").Layout("layoutTop").GridView("grid_view");

  // Simulating long touch at the specific point within a cell
  actionbar.LongTouchCellXY(8, 1, 15, 15);
}

Python

def Test(): 
  # Select the Android device
  Mobile.SetCurrent("MyDevice")
  # Obtain the tested application
  app = Mobile.Device().Process("com.example.myapp")
  # Obtain a GridView
  gridViewObj = app.RootLayout("").Layout("layoutTop").GridView("grid_view")

  # Simulating long touch at the specific point within a cell
  actionbar.LongTouchCellXY(8, 1, 15, 15)

VBScript

Sub Test

  Dim app, gridViewObj

  ' Select the Android device
  Mobile.SetCurrent("MyDevice")
  ' Obtain the tested application
  Set app = Mobile.Device.Process("com.example.myapp")
  ' Obtain a GridView
  Set gridViewObj = app.RootLayout("").Layout("layoutTop").GridView("grid_view")

  ' Simulating long touch at the specific point within a cell
  Call gridViewObj.LongTouchCellXY(8, 1, 15, 15)

End Sub

DelphiScript

function Test();
var
  app, gridViewObj: OleVariant;
begin
  
  // Select the Android device
  Mobile.SetCurrent('MyDevice');
  // Obtain the tested application
  app := Mobile.Device.Process('com.example.myapp');
  // Obtain a GridView
  gridViewObj := app.RootLayout('').Layout('layoutTop').GridView('grid_view');

  // Simulating long touch at the specific point within a cell
  actionbar.LongTouchCellXY(8, 1, 15, 15);
end;

C++Script, C#Script

function Test()
{
  // Select the Android device
  Mobile["SetCurrent"]("MyDevice");
  // Obtain the tested application
  var app = Mobile["Device"]["Process"]("com.example.myapp");
  // Obtain a GridView
  var gridViewObj = app["RootLayout"]("")["Layout"]("layoutTop")["GridView"]("grid_view");

  // Simulating long touch at the specific point within a cell
  gridViewObj["LongTouchCellXY"](8, 1, 15, 15);
}

See Also

Testing Android Applications (Legacy)
Selecting Grid View Cells
LongTouchCell Action (Android Controls)
TouchCell Action (Android Controls)
TouchCellXY Action (Android Controls)

Highlight search results