Click on a Point, (x, y) tuple, Match, or MatchList.
Syntax
click(target, hold_ms=0, offset=(0, 0), random=0, delay_before=0, delay_after=0, parallel=False)Parameters
| Name | Description |
|---|---|
targetPoint | tuple[Number, Number] | Match | MatchList | Target Point, coordinate tuple, found Match, or MatchList. Match/MatchList values with multiple points click each found point. Required · Positional or named No default |
hold_msInt | Hold duration in milliseconds Optional · Positional or named Default: 0 |
offsettuple[Number, Number] | Add a pixel offset after resolving the target point. Optional · Positional or named Default: (0, 0) |
randomNumber | tuple[Number, Number] | Add random pixel offset after resolving the target point. Optional · Positional or named Default: 0 |
delay_beforeNumber | Delay before the click in milliseconds. Optional · Positional or named Default: 0 |
delay_afterNumber | Delay after the click in milliseconds. Optional · Positional or named Default: 0 |
parallelBoolean | When True, returns a numeric touch id. In collect mode the touch waits for Touch.send(); collected overlapping touches may start at different delay_before offsets without cancelling each other. Optional · Positional or named Default: False |
Returns
Number | list[Number] | None — Returns one numeric id for one queued parallel click, a list[Number] when a multi-point Match or MatchList queues multiple parallel clicks, otherwise None.Behavior / side effects
Click on a Point, (x, y) tuple, Match, or MatchList. Every parameter supports positional or named form in the documented order. Use Point(x, y) for coordinate metadata such as scale/anchor; use (x, y) for fixed pixel coordinates. Use parallel=True to queue this touch and receive its numeric id; call Touch.cancel(id) or Touch.cancel() to cancel queued/active touches.
Execution
- Blocking: Conditional
- Thread safety: Limited
- Parallel execution: Conditional
Android gestures share the device. parallel=True queues a touch id but does not make delay_before or delay_after non-blocking outside collect mode. Within collect mode touches are collected for Touch.send(); Touch.wait() waits for their completion.
Example
# Click screen coordinates with Point or tuple
click(Point(500, 900))
click((500, 900))
click((500, 900), hold_ms=200)
click(Point(500, 900), 0, (0, 0), 10, 0, 500)
match = Region(100, 200, 300, 400).find("start", 3000)
if match.found:
click(match, offset=(0, 6))
hits = Region(100, 200, 300, 400).find_any(["a", "b"], 3000)
if hits:
click(hits, random=0)
# Collect two parallel touches, send them together, then wait for the queue
Touch.collect()
a = click(Point(300, 900), parallel=True)
b = click(Point(780, 900), parallel=True)
Touch.send()
Touch.wait()
# Hold p1, then tap p2 after 1 second without releasing p1
Touch.collect()
p1 = click(Point(300, 900), hold_ms=5000, parallel=True)
p2 = click(Point(780, 900), hold_ms=1000, delay_before=1000, parallel=True)
Touch.send()
Touch.cancel(p1)
Touch.wait()Errors / limitations
No additional limitations documented; follow the parameter and behavior contract above.