Description
Use the Image Touch operation to simulate a touch in a region on a mobile device's screen (for instance, touching a control in a tested application). The region is specified by its image in the Image Repository collection.
Requirements
This operation is available only if you have a license for TestComplete Mobile module.
Scripting Analogue
The operation is an analogue of the ImageSetItem.Touch
method.
Child Operations
The operation cannot have child operations.
Operation Parameters
The operation uses the following parameters:
X
Specifies the horizontal coordinate of the touch (see Remarks).
Y
Specifies the vertical coordinate of the touch (see Remarks).
SearchArea
Optional. Object. Specifies the area within which the operation will search for the image. Can take the following values:
-
The
AndroidDevice
oriOSDevice
object. Access the device by calling theMobile.Device
method. -
The full name of a window or onscreen object in your mobile application.
If the parameter is omitted, the operation will search for the image on the screen of the current mobile device (you can set the current device by calling Mobile.SetCurrent
in your script code, or the Select Device or Device Loop operation in your keyword test).
Specifying parameters when adding the operation
When you add the operation to your keyword test, TestComplete displays a wizard where you can specify all the following parameters:
Select Image
On this page, you select an image the operation will search for on your mobile device screen. You can either select an existing image from your Image Repository or you can capture an image from screen:
To select an existing image:
-
Select the image set that includes the needed image from the Image Set drop-down list.
-
The wizard will show a list of images. Select the needed image and click Next.
To capture a new image:
-
Click Capture New Image.
-
TestComplete will call the Add Image to Image Repository wizard.
-
Follow the wizard instructions to capture the needed image on the screen of your mobile device.
Your mobile device must be connected to TestComplete. To learn how to do this, see —
Connecting TestComplete to Android Devices
Preparing Applications, Devices, and Test Computers for iOS Testing
In addition, to access the screen of your iOS device, your tested application must be prepared for testing and running on the device.
Operation Parameters
On this page, you specify the operation parameters described above.
Modifying Parameters
-
Select the operation’s row in the test.
-
Select the Value cell and then click within it or press F2. This will activate the in-place editor.
-
Click the ellipsis button in the in-place editor. This will call the dialog, which is similar to the one described above. In this dialog, you can specify parameter values.
-
Alternatively, to invoke this dialog, simply double-click the operation in the Keyword Test editor.
-
Click OK to close the dialog and apply the changes.
-
Press Enter to confirm the changes and close the in-place editor, or press Esc to close the editor discarding any changes.
Remarks
TestComplete stores a collection of images of the desired control or screen area in the Image Repository (see Image-Based Testing).
The coordinates are specified relative to the top-left corner of the control’s recognition area marked with a red frame in the Preview box of the ImageSet editor.
If the X and Y coordinates are omitted, the touch is simulated in the center of the control’s recognition area.
See Also
Mobile Category
Device Touch Operation
Device Keys Operation
Simulating User Actions Over Android Devices
Image-Based Testing