def appLogcat(self): #全部在线设备的安装 commands = [] for devices in AdbTools().getOnlineDevices(): cmd = Common().adbLogcat(devices) commands.append(cmd) return commands
def get_apk_activity(self): cmd = Common().aaPath() + " | findstr launchable-activity:" result = "" p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE, shell=True) (output, err) = p.communicate() if output != "": result = output.split()[1].decode()[6:-1] return result
def get_apk_package(self): cmd = Common().aaPath() + " | findstr package:" result = "" p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE, shell=True) (output, err) = p.communicate() output = str(output, encoding='utf8') if output != "": result = output.split()[1][6:-1] return result
def get_apk_name(self): cmd = Common().aaPath() + " | findstr application-label-zu: " result = "" p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE, shell=True) (output, err) = p.communicate() output = str(output, encoding='utf8') if output != "": result = output.split("'")[1] return result
def get_apk_version(self): cmd = Common().aaPath() result = "" p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE, shell=True) (output, err) = p.communicate() if output != "": result = output.split()[3].decode()[12:] result = result.split("'")[1] return result
#!/usr/bin/env python #coding=utf-8 from Utils.adbUtils import AdbTools from Utils.Common import Common class UninstallCase: def AppUninstall(self): commands = [] for devices in AdbTools().getOnlineDevices(): cmd = AdbTools(devices).uninstall(packName) commands.append(cmd) return commands if __name__ == '__main__': path = Common().apkPath() packName = AdbTools().dump_apk_name(path) UninstallCase().AppUninstall()
#!/usr/bin/env python #coding=utf-8 from Utils.adbUtils import AdbTools from Utils.Common import Common class Logcat: def appLogcat(self): #全部在线设备的安装 commands = [] for devices in AdbTools().getOnlineDevices(): cmd = Common().adbLogcat(devices) commands.append(cmd) return commands if __name__ == '__main__': path = Common().logTag() Logcat().appLogcat()
def get_apk_size(self): size = os.path.getsize(Common().apkPath()) / (1024 * 1000) return ('%.2f' % size) + "M" #保留小数点后两位