Skip to content

Click In (x, y)

Summary

  • Internal name: ClickInXY
  • Category: Android UI
  • Purpose: Click the screen at a fixed (x, y) coordinate via a synthetic touch gesture.
  • Task type: Normal

Compatibility

  • Minimum AndroMate version: 1.1.0
  • Maximum AndroMate version: 1.1.0
  • Minimum Android: Android 13 (API 33)
  • Maximum Android tested: Android 16 (API 36)
  • Supported manufacturers:

    • Samsung (One UI 6.x / 7.x / 8.x)
    • Other manufacturers - not supported yet (Xiaomi HyperOS and Google Pixel are being adapted)
    • Required permissions:
    • ACCESSIBILITY_SERVICE

Detailed description

The Click In (x, y) task dispatches a short synthetic touch gesture (dispatchGesture, a 100ms tap) at a fixed screen coordinate. One of the actions split out of the deprecated combined ScreenAutomator task - see Screen Automator.

Unlike Click In Element, this task doesn't search the accessibility tree at all - it blindly taps a pixel position, so it's resolution- and layout-dependent. Prefer Click In Element when the target has readable text/content-description/resource-id; use this task only when no such selector is available (e.g. custom-drawn canvases, games).


Input parameters

Parameter Type Required Possible values Android Compatibility AndroMate Compatibility Default
ClickInXY_X Integer (resolvable) Yes ≥ 0 (screen pixel X) Android 13 (API 33) -> Android 16 (API 36) 1.1.0 -> 1.1.0 0
ClickInXY_Y Integer (resolvable) Yes ≥ 0 (screen pixel Y) Android 13 (API 33) -> Android 16 (API 36) 1.1.0 -> 1.1.0 0

Output parameters

This task produces no output variable. It returns a VoidResult on success.


Exceptions

Code Exception Name Description
SCREEN-AUTOMATOR-ERROR-004 Invalid X Y Input ClickInXY_X or ClickInXY_Y is negative.
SCREEN-AUTOMATOR-ERROR-010 Screen Automator Service Not Connected The AndroMate accessibility service isn't enabled/connected.
SCREEN-AUTOMATOR-ERROR-011 Screen Automator Action Failed The gesture dispatch failed (rare - dispatchGesture is fire-and-forget and normally always succeeds at the API level).

Execution flowchart

flowchart TD
    Start([ClickInXY]) --> CheckConnected{Accessibility service\nconnected?}
    CheckConnected -->|No| E1[SCREEN-AUTOMATOR-ERROR-010\nSERVICE_NOT_CONNECTED]
    CheckConnected -->|Yes| CheckXY{X ≥ 0 and Y ≥ 0?}
    CheckXY -->|No| E2[SCREEN-AUTOMATOR-ERROR-004\nINVALID_X_Y_INPUT]
    CheckXY -->|Yes| Dispatch["dispatchGesture\n100ms tap at (X, Y)"]
    Dispatch --> Success([VoidResult])

    E1 --> Error([Exception])
    E2 --> Error

    style Start fill:#e3f2fd
    style Success fill:#c8e6c9
    style Error fill:#ffcdd2
    style Dispatch fill:#fff9c4

How it works:

  1. Check connection: fails fast with SERVICE_NOT_CONNECTED if the accessibility service isn't enabled.
  2. Validate coordinates: negative X or Y raises INVALID_X_Y_INPUT.
  3. Dispatch the tap: a single 100ms touch stroke at (X, Y).

Code examples

Example 1 - Tap a fixed point

{
  "ClickInXY": [
    { "id": "1", "title": "Tap center", "ClickInXY_X": 540, "ClickInXY_Y": 1200 }
  ]
}

Input parameter details

1. Input parameter: ClickInXY_X

The X pixel coordinate to tap, in the device's screen coordinate space.

Example

"ClickInXY_X": 540

2. Input parameter: ClickInXY_Y

The Y pixel coordinate to tap.

Example

"ClickInXY_Y": 1200

Output parameter details

This task has no output parameters.


Complete JSON example

{
  "ClickInXY": [
    { "id": "1", "title": "Tap top-left icon", "ClickInXY_X": 60, "ClickInXY_Y": 90 }
  ]
}