Exemplo n.º 1
0
 def get_app_path(self):
     """
     get app file path of current app
     :return:
     """
     if self.app_path is not None:
         return self.app_path
     if self.package_name is None:
         self.logger.warning("Trying to get app path without package name")
         return None
     # if we only have package name, use `adb pull` to get the package from device
     try:
         from droidbot import DroidBot
         app_path_in_device = DroidBot.get_instance().device.get_adb().getPackagePath(self.package_name)
         out_dir = DroidBot.get_instance().output_dir
         app_path = os.path.join(out_dir, 'temp', "%s.apk" % self.package_name)
         subprocess.check_call(["adb", "pull", app_path_in_device, app_path])
         self.app_path = app_path
         return self.app_path
     except Exception:
         return None