Skip to content

touch ​

touch.click() ​

Tap the screen at the given coordinates.

python
touch.click(x: int, y: int, id: int = 1) -> None

Arguments ​

NameTypeDefaultDescription
xintX coordinate.
yintY coordinate.
idint1Finger ID.

Return ​

None.

Example ​

python
import time
from catscript import touch

if __name__ == "__main__":
    touch.click(100, 100)

touch.long_press() ​

Press and hold a point on the screen.

python
touch.long_press(x: int, y: int, duration: int = 500, id: int = 1) -> None

Arguments ​

NameTypeDefaultDescription
xintX coordinate.
yintY coordinate.
durationint500Hold duration in milliseconds.
idint1Finger ID.

Return ​

None.

Raises ValueError if duration <= 0 or id < 0.

Example ​

python
from catscript import touch

if __name__ == "__main__":
    touch.long_press(300, 800, duration=800)

touch.swipe() ​

Swipe from one point to another.

python
touch.swipe(x1: int, y1: int, x2: int, y2: int, duration: int = 300, id: int = 1) -> None

Arguments ​

NameTypeDefaultDescription
x1intStart X coordinate.
y1intStart Y coordinate.
x2intEnd X coordinate.
y2intEnd Y coordinate.
durationint300Swipe duration in milliseconds.
idint1Finger ID.

Return ​

None.

Raises ValueError if duration <= 0 or id < 0.

Example ​

python
from catscript import touch

if __name__ == "__main__":
    touch.swipe(500, 2000, 500, 600, duration=300)

touch.down() ​

Touch down at the given coordinates.

python
touch.down(x: int, y: int, id: int = 1) -> None

Arguments ​

NameTypeDefaultDescription
xintX coordinate.
yintY coordinate.
idint1Finger ID.

Return ​

None.

Example ​

python
import time
from catscript import touch

if __name__ == "__main__":
    touch.down(100, 100)
    time.sleep(0.1)
    touch.up()

touch.move() ​

Move an active touch.

python
touch.move(x: int, y: int, id: int = 1) -> None

Arguments ​

NameTypeDefaultDescription
xintX coordinate.
yintY coordinate.
idint1Finger ID.

Return ​

None.

Example ​

python
import time
from catscript import touch

def slide_x(start, end, step, y):
    xs = range(start + step, end, step)
    touch.down(start, y)
    time.sleep(0.01)
    for x in xs:
        touch.move(x, y)
        time.sleep(0.01)
    touch.up()

if __name__ == "__main__":
    slide_x(100, 500, 20, 500)

touch.up() ​

Release a touch.

python
touch.up(id: int = 1) -> None

Arguments ​

NameTypeDefaultDescription
idint1Finger id.

Return ​

None.

Example ​

python
import time
from catscript import touch

if __name__ == "__main__":
    touch.down(100, 100)
    time.sleep(0.1)
    touch.up()

Python automation for jailbroken iOS