Exemple #1
0
 def loop_snap_dump(self):
     dn.dnld(
         self._target, 'screencap /sdcard/Pictures/%s/%s.dump' %
         (self._target, 'screen_snap'))
     while True:
         file_mod_time = self.get_FileModifyTime(self._second_dump_path)
         file_size_m = self.get_FileSize(self._second_dump_path)
         if file_mod_time and file_mod_time != self._dump_time_cache and file_size_m != 0:
             self._dump_time_cache = file_mod_time
             break
Exemple #2
0
 def img_push(self, snp_path=''):
     snp_path = snp_path or self.create_ram_unid()
     self.v_sleep(1000)
     path_imx = dn.screen_snap(self._target, snp_path)
     self.v_sleep(2400)
     self.snap_img_cache_path = path_imx
     return path_imx
Exemple #3
0
 def set_log(self, fn_name):
     try:
         log_path_snap = FILE_PARENT_FOLDER + 'log\\' + self.v_now_time(
         ) + '\\'
         self.v_create_dir(log_path_snap)
         with open(log_path_snap + 'error.txt', 'a',
                   encoding='utf-8') as file_obj:
             file_obj.write(str(fn_name))
         img_path = dn.screen_snap(self._target, 'error')
         shutil.copy(img_path, log_path_snap + 'error.png')
     except Exception as e:
         traceback.print_exc()
         print(e)
Exemple #4
0
 def change_imei_and_restart(self):
     try:
         dn.quit(self._target)
         self.v_sleep(1000)
         dn.change_device_data(self._target)
         self.v_sleep(1000)
         dn.launch(self._target)
         dn_times = 0
         while True:
             self.v_sleep(1000)
             if dn.is_running(self._target):
                 break
             else:
                 dn_times += 1
                 if (dn_times > 120):
                     dn_times = 0
                     dn.launch(self._target)
                 print('%s restarting' % (self._target))
         return True
     except Exception as e:
         traceback.print_exc()
         print(e)
Exemple #5
0
def get_running_emu():
    return dn.list_running()
Exemple #6
0
 def clean_app(self):
     return dn.clear_app(self._target)
Exemple #7
0
 def install_app(self, path):
     if (not path):
         return False
     return dn.install(self._target, path)
Exemple #8
0
 def un_install_app(self):
     dn.uninstall(self._target)
     self.v_sleep(2000)
     return True
Exemple #9
0
 def delect_file(self, file_path):
     dn.del_file_libs(self._target, file_path)
Exemple #10
0
 def key_code_press(self, key_num):
     dn.key_code_event(self._target, key_num)
Exemple #11
0
 def text_into(self, text):
     dn.input_text(self._target, text)
Exemple #12
0
 def move_to(self, x, y):
     dn.dnld(
         self._target,
         "sendevent dev/input/event2 3 53 %s\nsendevent dev/input/event2 3 54 %s\nsendevent dev/input/event2 0 0 0\n"
         % (x, y))
Exemple #13
0
 def touch_up(self):
     dn.dnld(
         self._target,
         "sendevent dev/input/event2 3 57 -1\nsendevent dev/input/event2 1 330 0\nsendevent dev/input/event2 1 325 0\nsendevent dev/input/event2 0 0 0\n"
     )
Exemple #14
0
 def touch_down(self):
     dn.dnld(
         self._target,
         "sendevent dev/input/event2 3 57 0\nsendevent dev/input/event2 1 330 1\nsendevent dev/input/event2 1 325 1\n"
     )
Exemple #15
0
 def v_run_apk(self):
     dn.invokeapp(self._target)
     self.v_sleep(2000)
     return True
Exemple #16
0
 def copy_file(self, old_path, new_path):
     dn.copy_file(self._target, old_path, new_path)
Exemple #17
0
 def click(self, x, y, delay, ramdom_time=0):
     ramdom_add = delay + random.uniform(0, ramdom_time)
     ra_x, ra_y = self.v_ramdom_xy(x, y)
     dn.touch(self._target, ra_x, ra_y, ramdom_add)
Exemple #18
0
 def swipe(self, x1, y1, x2, y2, delay, ramdom_time=0):
     ramdom_add = delay + random.uniform(0, ramdom_time)
     ra_x1, ra_y1 = self.v_ramdom_xy(x1, y1)
     ra_x2, ra_y2 = self.v_ramdom_xy(x2, y2)
     dn.swipe(self._target, (ra_x1, ra_y1), (ra_x2, ra_y2), ramdom_add)