Touch Action (Mobile Objects)

Applies to TestComplete 15.70, last modified on December 17, 2024
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

Simulates a touch on an object in a mobile application at a specified point (by default, in the object’s center) and is similar to Click.

Declaration

TestObj.Touch(X, Y)

TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
X [in]    Optional    Integer Default value: -1   
Y [in]    Optional    Integer Default value: -1   
Result None

Applies To

All Android, iOS and Xamarin.Forms objects

View Mode

This method is available in the Object Browser panel and in other panels and dialogs in both Basic and Advanced view modes.

Parameters

The method has the following parameters:

X

Specifies the horizontal coordinate (in pixels) of the point where a touch will be simulated. This coordinate is specified relative to the top-left corner of the underlying control. If the coordinate is omitted, the touch is simulated in the center of the control.

Y

Specifies the vertical coordinate (in pixels) of the point where a touch will be simulated. This coordinate is specified relative to the top-left corner of the underlying control. If the coordinate is omitted, the touch is simulated in the center of the control.

Result Value

None.

See Also

Testing Mobile Applications
Simulating Basic Touch Actions Over Android Devices (Legacy)
LongTouch Action (Android Objects)
LongTouch Action (Mobile Objects)
Click Action (Mobile Objects)

Highlight search results