airtest.core.android.touch_methods.touch_proxy module

class TouchProxy(touch_method)[源代码]

基类:object

Perform touch operation according to the specified method

TOUCH_METHODS = {'MAXTOUCH': <class 'airtest.core.android.touch_methods.touch_proxy.MaxtouchImplementation'>, 'MINITOUCH': <class 'airtest.core.android.touch_methods.touch_proxy.MinitouchImplementation'>}
classmethod check_touch(touch_impl)[源代码]
classmethod auto_setup(adb, default_method=None, ori_transformer=None, size_info=None, input_event=None)[源代码]
参数:
  • adbairtest.core.android.adb.ADB

  • default_method – The default click method, such as “MINITOUCH”

  • ori_transformer – dev._touch_point_by_orientation

  • size_info – the result of dev.get_display_info()

  • input_event – dev.input_event

  • *args

  • **kwargs

Returns: TouchProxy object

示例

>>> dev = Android()
>>> touch_proxy = TouchProxy.auto_setup(dev.adb, ori_transformer=dev._touch_point_by_orientation)
>>> touch_proxy.touch((100, 100))
register_touch(cls)[源代码]
class AdbTouchImplementation(base_touch)[源代码]

基类:object

METHOD_NAME = 'ADBTOUCH'
touch(pos, duration=0.01)[源代码]
swipe(p1, p2, duration=0.5, *args, **kwargs)[源代码]
teardown()[源代码]
class MinitouchImplementation(minitouch, ori_transformer)[源代码]

基类:AdbTouchImplementation

METHOD_NAME = 'MINITOUCH'
METHOD_CLASS

Minitouch 的别名

touch(pos, duration=0.01)[源代码]
swipe(p1, p2, duration=0.5, steps=5, fingers=1)[源代码]
pinch(center=None, percent=0.5, duration=0.5, steps=5, in_or_out='in')[源代码]
swipe_along(coordinates_list, duration=0.8, steps=5)[源代码]
two_finger_swipe(tuple_from_xy, tuple_to_xy, duration=0.8, steps=5, offset=(0, 50))[源代码]
perform(motion_events, interval=0.01)[源代码]
class MaxtouchImplementation(maxtouch, ori_transformer)[源代码]

基类:MinitouchImplementation

METHOD_NAME = 'MAXTOUCH'
METHOD_CLASS

Maxtouch 的别名

perform(motion_events, interval=0.01)[源代码]