def kill_adb_port(): cmd = "lsof -i tcp:5037" result = run_command_on_shell(cmd) #record = result.split("\n")[1] # port = record.split(" ")[1] port = re.search("\d+", result[1]) if port: cmd_port = "kill -9 {}".format(port.group(0)) run_command_on_shell(cmd_port)
def is_device_running(retry_times=MAX_TIMES, interval=WAIT_TIME): i = 0 while i < retry_times: time.sleep(interval) device_info = run_command_on_shell('adb devices') if len(device_info) > 1: for line in device_info: preporter.info(line) return True i += 1 return False
def get_device_list(): result = run_command_on_shell('VBoxManage list vms') print(result) device_list = [] for each in result.split('\n'): device_list.append(each[0:each.index("{") - 1]) # print(device_list) translated_dataframe = pd.DataFrame(device_list, columns=["Devices"]) translated_dataframe["Run"] = "" writer = pd.ExcelWriter('devices.xlsx') translated_dataframe.to_excel(writer, 'android') writer.save()
def get_device_name(): cmd = "adb shell getprop ro.product.model" result = run_command_on_shell(cmd)[0] return result
def get_android_version(): cmd = "adb shell getprop ro.build.version.release" result = run_command_on_shell(cmd)[0] return result