airtest.core.android.cap_methods.screen_proxy module

class ScreenProxy(screen_method)[source]

Bases: object

Perform screen operation according to the specified method

SCREEN_METHODS = {'ADBCAP': <class 'airtest.core.android.cap_methods.adbcap.AdbCap'>, 'JAVACAP': <class 'airtest.core.android.cap_methods.javacap.Javacap'>, 'MINICAP': <class 'airtest.core.android.cap_methods.minicap.Minicap'>}
classmethod register_method(name, method_class)[source]
classmethod check_frame(cap_method)[source]

Test whether a frame of image can be obtained correctly

测试能否正确获取一帧图像

Parameters:

cap_methodairtest.core.android.cap_methods.base_cap.BaseCap

Returns:

classmethod auto_setup(adb, default_method=None, *args, **kwargs)[source]

In order of priority, try to initialize all registered screenshot methods, select an available method to return

按优先顺序,尝试初始化注册过的所有屏幕截图方法,选择一个可用方法返回

Custom method 自定义方法 > MINICAP > JAVACAP > ADBCAP

Parameters:

Returns: ScreenProxy object

Examples

>>> dev = Android()
>>> screen_proxy = ScreenProxy.auto_setup(dev.adb, rotation_watcher=dev.rotation_watcher)
>>> screen_proxy.get_frame_from_stream()
>>> screen_proxy.teardown_stream()
register_screen()[source]