Static helper for parallel click/swipe actions created by the UI or code via click(..., parallel=True) and swipe(..., parallel=True).
Syntax
Touch
This class cannot be constructed directly.
Parameters
None
Returns
—
Behavior / side effects
Static helper for parallel click/swipe actions created by the UI or code via click(..., parallel=True) and swipe(..., parallel=True). You can collect click/swipe actions and send them together, or inspect click/swipe actions that are active or queued. The helper also supports cancelling active click/swipe actions (Android 8.0+ only).
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
Touch.collect()
a = click(Point(300, 900), hold_ms=5000, parallel=True)
b = click(Point(780, 900), hold_ms=1000, delay_before=1000, parallel=True)
sent = Touch.send()
Touch.cancel(a)
Touch.wait()
Errors / limitations
No additional limitations documented; follow the parameter and behavior contract above.
Enable collect mode for click/swipe calls with parallel=True.
Syntax
Touch.collect()
Parameters
None
Returns
None
Behavior / side effects
Enable collect mode for click/swipe calls with parallel=True. When enabled, parallel click/swipe calls are not sent immediately; they are collected and only sent after Touch.send(). This method works for both UI/code. If Touch.collect() is not enabled, parallel click/swipe calls are sent immediately, and later click/swipe calls must wait for the previous click/swipe to finish before they can run because running a later click/swipe immediately would cancel the previous one. You can intentionally cancel the previous click/swipe with Touch.cancel().
Execution
Blocking: No
Thread safety: Limited
Parallel execution: Conditional
Collect/send and touch-state queries do not wait for gesture completion. Collected commands reach the executor only on Touch.send(); queue snapshots can change immediately.
Example
# Inspect or control collected touches
Touch.collect()
first = click((300, 900), hold_ms=1000, parallel=True)
second = click((780, 900), delay_before=300, parallel=True)
Touch.send()
Touch.wait()
Errors / limitations
No additional limitations documented; follow the parameter and behavior contract above.
Send all click/swipe calls collected by Touch.collect() at once, return their matching numeric ids, then turn off Touch.collect() collection mode.
Syntax
Touch.send()
Parameters
None
Returns
list[Number]
Behavior / side effects
Send all click/swipe calls collected by Touch.collect() at once, return their matching numeric ids, then turn off Touch.collect() collection mode.
Execution
Blocking: No
Thread safety: Limited
Parallel execution: Conditional
Collect/send and touch-state queries do not wait for gesture completion. Collected commands reach the executor only on Touch.send(); queue snapshots can change immediately.
Example
# Inspect or control collected touches
Touch.collect()
first = click((300, 900), hold_ms=1000, parallel=True)
second = click((780, 900), delay_before=300, parallel=True)
Touch.send()
Touch.wait()
Errors / limitations
No additional limitations documented; follow the parameter and behavior contract above.
Collect/send and touch-state queries do not wait for gesture completion. Collected commands reach the executor only on Touch.send(); queue snapshots can change immediately.
Example
# Inspect or control collected touches
Touch.collect()
first = click((300, 900), hold_ms=1000, parallel=True)
second = click((780, 900), delay_before=300, parallel=True)
Touch.send()
print(Touch.queued())
Touch.wait()
Errors / limitations
No additional limitations documented; follow the parameter and behavior contract above.
Collect/send and touch-state queries do not wait for gesture completion. Collected commands reach the executor only on Touch.send(); queue snapshots can change immediately.
Example
# Inspect or control collected touches
Touch.collect()
first = click((300, 900), hold_ms=1000, parallel=True)
second = click((780, 900), delay_before=300, parallel=True)
Touch.send()
print(Touch.active())
Touch.wait()
Errors / limitations
No additional limitations documented; follow the parameter and behavior contract above.
Collect/send and touch-state queries do not wait for gesture completion. Collected commands reach the executor only on Touch.send(); queue snapshots can change immediately.
Example
# Inspect or control collected touches
Touch.collect()
first = click((300, 900), hold_ms=1000, parallel=True)
second = click((780, 900), delay_before=300, parallel=True)
Touch.send()
print(Touch.all())
Touch.wait()
Errors / limitations
No additional limitations documented; follow the parameter and behavior contract above.
Cancel one queued or active touch by numeric id. When id is None, cancels every queued/active touch and returns the accepted cancel count. Active cancel requires Android 8.0+; Android 7.x scripts fail with a clear error when an active touch is targeted.
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
# Inspect or control collected touches
Touch.collect()
first = click((300, 900), hold_ms=1000, parallel=True)
second = click((780, 900), delay_before=300, parallel=True)
Touch.send()
# Active cancellation requires Android 8 or newer
Touch.cancel(second)
Touch.wait()
Errors / limitations
No additional limitations documented; follow the parameter and behavior contract above.