def __init__(self, serialno=None, host=None, cap_method=CAP_METHOD.MINICAP_STREAM, touch_method=TOUCH_METHOD.MINITOUCH, ime_method=IME_METHOD.YOSEMITEIME, ori_method=ORI_METHOD.MINICAP, ): super(Android, self).__init__() self.serialno = serialno or self.get_default_device() self.cap_method = cap_method.upper() self.touch_method = touch_method.upper() self.ime_method = ime_method.upper() self.ori_method = ori_method.upper() # init adb self.adb = ADB(self.serialno, server_addr=host) self.adb.wait_for_device() self.sdk_version = self.adb.sdk_version self._display_info = {} self._current_orientation = None # init components self.rotation_watcher = RotationWatcher(self.adb) self.minicap = Minicap(self.adb, ori_function=self.get_display_info) self.javacap = Javacap(self.adb) self.minitouch = Minitouch(self.adb, ori_function=self.get_display_info) self.yosemite_ime = YosemiteIme(self.adb) self.recorder = Recorder(self.adb) self._register_rotation_watcher()
def __init__(self, serialno=None, host=None, cap_method=CAP_METHOD.MINICAP_STREAM, touch_method=TOUCH_METHOD.MINITOUCH, ime_method=IME_METHOD.YOSEMITEIME, ori_method=ORI_METHOD.MINICAP, display_id=None, input_event=None): super(Android, self).__init__() self.serialno = serialno or self.get_default_device() self.cap_method = cap_method.upper() self.touch_method = touch_method.upper() self.ime_method = ime_method.upper() self.ori_method = ori_method.upper() self.display_id = display_id self.input_event = input_event # init adb self.adb = ADB(self.serialno, server_addr=host, display_id=self.display_id, input_event=self.input_event) self.adb.wait_for_device() self.sdk_version = self.adb.sdk_version if self.sdk_version >= SDK_VERISON_ANDROID10 and self.touch_method == TOUCH_METHOD.MINITOUCH: self.touch_method = TOUCH_METHOD.MAXTOUCH self._display_info = {} self._current_orientation = None # init components self.rotation_watcher = RotationWatcher(self.adb) self.minicap = Minicap(self.adb, ori_function=self.get_display_info, display_id=self.display_id) self.javacap = Javacap(self.adb) self.minitouch = Minitouch(self.adb, ori_function=self.get_display_info, input_event=self.input_event) self.maxtouch = Maxtouch(self.adb, ori_function=self.get_display_info) self.yosemite_ime = YosemiteIme(self.adb) self.recorder = Recorder(self.adb) self._register_rotation_watcher() self._touch_proxy = None
def __init__(self, serialno=None, host=None, cap_method=CAP_METHOD.MINICAP_STREAM, touch_method=TOUCH_METHOD.MINITOUCH, ime_method=IME_METHOD.YOSEMITEIME): super(Android, self).__init__() self.serialno = serialno or ADB().devices(state="device")[0][0] self.cap_method = cap_method self.touch_method = touch_method self.ime_method = ime_method # init adb self.adb = ADB(self.serialno, server_addr=host) self.adb.wait_for_device() self.sdk_version = self.adb.sdk_version # init components self.rotation_watcher = RotationWatcher(self.adb) self.minicap = Minicap(self.adb) self.javacap = Javacap(self.adb) self.minitouch = Minitouch(self.adb) self.yosemite_ime = YosemiteIme(self.adb) self.recorder = Recorder(self.adb) self._register_rotation_watcher()
WIRE_VIVO = '192.168.1.101:5555' BASE_DIR = os.path.dirname(__file__) ROK_PACKAGE_NAME = 'com.lilithgames.rok.offical.cn' logger = get_logger("airtest") logger.setLevel(logging.INFO) if not cli_setup(): auto_setup(__file__, logdir=True, devices=[ "android://127.0.0.1:5037/%s" % (VM if DEBUG else WIRE_VIVO), ]) dev = Android() jcap = Javacap(dev.adb) import matplotlib.pyplot as plt # ret = find_all(Template(r"tpl1610026421082.png", record_pos=(-0.429, 0.195), resolution=(2280, 1080))) # print(ret) # exists(Template(r"tpl1610026442515.png", record_pos=(-0.431, 0.118), resolution=(2280, 1080))) # ret = find_all(Template(r"tpl1610026478715.png", record_pos=(-0.429, 0.194), resolution=(2280, 1080))) # print(ret) # ret = find_all(Template(r"tpl1610026507266.png", record_pos=(-0.431, 0.118), resolution=(2280, 1080))) # print(ret) # exists(Template(r"tpl1610026732683.png", record_pos=(0.437, 0.203), resolution=(2280, 1080))) # exists(Template(r"tpl1610026787532.png", record_pos=(0.226, 0.116), resolution=(2280, 1080))) # exists(Template(r"tpl1610026804600.png", record_pos=(-0.228, 0.008), resolution=(2280, 1080)))