airtest.core.android.minitouch module

class Minitouch(adb, backend=False, ori_function=None)[source]

Bases: object

Super fast operation from minitouch

References: https://github.com/openstf/minitouch

install_and_setup(*args, **kwargs)[source]

Install and setup minitouch

Returns:None
uninstall()[source]

Uninstall minitouch

Returns:None
install()[source]

Install minitouch

Returns:None
setup_server()[source]

Setip minitouch server and adb forward

Returns:server process
touch(*args, **kwargs)[source]

Perform touch event

minitouch protocol example:

d 0 10 10 50
c
<wait in your own code>
u 0
c
Parameters:
  • tuple_xy – coordinates (x, y)
  • duration – time interval for touch event, default is 0.01
Returns:

None

swipe_along(*args, **kwargs)[source]

Perform swipe event across multiple points in sequence.

Parameters:
  • coordinates_list – list of coordinates: [(x1, y1), (x2, y2), (x3, y3)]
  • duration – time interval for swipe duration, default is 0.8
  • steps – size of swipe step, default is 5
Returns:

None

swipe(*args, **kwargs)[source]

Perform swipe event.

Parameters:
  • tuple_from_xy – start point
  • tuple_to_xy – end point
  • duration – time interval for swipe duration, default is 0.8
  • steps – size of swipe step, default is 5
Returns:

None

two_finger_swipe(*args, **kwargs)[source]

Perform two finger swipe action

minitouch protocol example:

d 0 0 0 50
d 1 1 0 50
c
m 0 20 0 50
m 1 21 0 50
c
m 0 40 0 50
m 1 41 0 50
c
m 0 60 0 50
m 1 61 0 50
c
m 0 80 0 50
m 1 81 0 50
c
m 0 100 0 50
m 1 101 0 50
c
u 0
u 1
c
Parameters:
  • tuple_from_xy – start point
  • tuple_to_xy – end point
  • duration – time interval for swipe duration, default is 0.8
  • steps – size of swipe step, default is 5
Returns:

None

pinch(*args, **kwargs)[source]

Perform pinch action

minitouch protocol example:

d 0 0 100 50
d 1 100 0 50
c
m 0 10 90 50
m 1 90 10 50
c
m 0 20 80 50
m 1 80 20 50
c
m 0 20 80 50
m 1 80 20 50
c
m 0 30 70 50
m 1 70 30 50
c
m 0 40 60 50
m 1 60 40 50
c
m 0 50 50 50
m 1 50 50 50
c
u 0
u 1
c
operate(*args, **kwargs)[source]

Perform down, up and move actions

Parameters:args

action arguments, dictionary containing type and x, y coordinates, e.g.:

{
"type" : "down",
"x" : 10,
"y" : 10
}
Raises:RuntimeError – is invalid arguments are provided
Returns:None
perform(*args, **kwargs)[source]

Perform a sequence of motion events including: UpEvent, DownEvent, MoveEvent, SleepEvent :param motion_events: a list of MotionEvent instances :param interval: minimum interval between events :return: None

safe_send(data)[source]

Send data to client

Parameters:data – data to send
Raises:Exception – when data cannot be sent
Returns:None
setup_client_backend()[source]

Setup backend client thread as daemon

Returns:None
setup_client()[source]

Setup client in following steps:

1. connect to server
2. receive the header
    v <version>
    ^ <max-contacts> <max-x> <max-y> <max-pressure>
    $ <pid>
3. prepare to send
Returns:None
teardown()[source]

Stop the server and client

Returns:None
class MotionEvent[source]

Bases: object

Motion Event to be performed by Minitouch

getcmd(transform=None)[source]
class DownEvent(coordinates, contact=0, pressure=50)[source]

Bases: airtest.core.android.minitouch.MotionEvent

getcmd(transform=None)[source]
class UpEvent(contact=0)[source]

Bases: airtest.core.android.minitouch.MotionEvent

getcmd(transform=None)[source]
class MoveEvent(coordinates, contact=0, pressure=50)[source]

Bases: airtest.core.android.minitouch.MotionEvent

getcmd(transform=None)[source]
class SleepEvent(seconds)[source]

Bases: airtest.core.android.minitouch.MotionEvent

getcmd(transform=None)[source]