How to use uninstall_app method in Airtest

Best Python code snippet using Airtest

__init__.py

Source:__init__.py Github

copy

Full Screen

...63def get_running_processes(self):64 return self.execute('get_running_processes', { 'deviceId': self.deviceId } )65def launch_app(self, app_id, arguments = [ ]):66 return self.command_executor._request('POST', self.command_executor._url + '/quamotion/device/' + self.deviceId + '/app/' + app_id + '/launch?strict', json.dumps(arguments))67def uninstall_app(self, app_id):68 return self.execute('uninstall_app', { 'deviceId': self.deviceId, 'appId': app_id } )69def kill_app(self, app_id):70 return self.execute('kill_app', { 'deviceId': self.deviceId, 'appId': app_id } )71def set_location(self, latitude, longitude):72 return self.execute('set_location', { 'latitude': latitude, 'longitude': longitude } )73def get_appId(self):74 return self.execute('get_appId', {} )['value']75def scroll_to(self, container_id, xpath):76 return self.execute('scroll_to', { 'elementId': container_id, 'value': xpath, 'using': By.XPATH } )77def scroll_to_visible(self, element_id):78 return self.execute('scroll_to_visible', {'elementId': element_id} )79webdriver.Remote.home_screen = home_screen80webdriver.Remote.get_installed_apps = get_installed_apps81webdriver.Remote.get_running_processes = get_running_processes...

Full Screen

Full Screen

ejercicio mobilephone.py

Source:ejercicio mobilephone.py Github

copy

Full Screen

...11• __init__(self, manufacturer, screen_size, num_cores)12• power_on(self)13• power_off(self)14• install_app(self, app)15• uninstall_app(self, app)16Crear al menos una instancia (móvil) a partir de la clase creada y «jugar» con los métodos,17visualizando cómo cambian sus atributos.18¿Serías capaz de extender el método install_app() para instalar varias aplicaciones a la19vez?20'''21class MobilePhone:22 def __init__(self, manufacturer, screen_size, num_cores):23 self.manufacturer = manufacturer24 self.screen_size = float(screen_size)25 self.num_cores = int(num_cores)26 self.status = 027 self.app = ['telefono','agenda','navegador']28 def power_on(self):29 self.status = 130 print("El movil esta encendido.")31 def power_off(self):32 self.status = 033 print("El movil esta apagado.")34 def install_app(self, *args):35 if self.status == 0:36 print("El movil no esta encendido.")37 else:38 for app in args:39 if app in self.app:40 print(f"La aplicacion '{app}' ya se encuentra instalada.")41 else:42 self.app.append(app)43 print(f"La aplicacion '{app}' se instalo con exito.")44 print(f"Esta es la lista de aplicaciones instaladas actualmente:\n {self.app}")45 def uninstall_app(self, *args):46 if self.status == 0:47 print("El movil no esta encendido.")48 else:49 for app in args:50 if app in self.app:51 self.app.remove(app)52 print(f"La aplicacion '{app}' se desinstalo con exito.")53 else: 54 print(f"ERROR: La aplicacion '{app}' no esta instalada.")55 print(f"Esta es la lista de aplicaciones tras la desinstalacion:\n {self.app}")56 57note20 = MobilePhone("samsung", 6.5, 8)58print(note20.manufacturer,note20.screen_size,note20.num_cores,note20.status,note20.app)59note20.power_on()60note20.power_off()61note20.install_app("whatsapp")62note20.uninstall_app("whatsapp")63note20.power_on()64note20.install_app("whatsapp")65note20.uninstall_app("pokemon")66note20.uninstall_app("whatsapp")67print(note20.app)68note20.install_app("whatsapp","instagram","facebook","snapchat")...

Full Screen

Full Screen

uninstall_apk.py

Source:uninstall_apk.py Github

copy

Full Screen

1import time2from functions import adb_shell_pm3class bcolors:4 HEADER = '\033[95m'5 OKBLUE = '\033[94m'6 OKCYAN = '\033[96m'7 OKGREEN = '\033[92m'8 WARNING = '\033[93m'9 FAIL = '\033[91m'10 ENDC = '\033[0m'11 BOLD = '\033[1m'12 UNDERLINE = '\033[4m'13def uninstall_app_func():14 adb_shell_pm.adb_shell_pm_function()15 print(bcolors.WARNING + "\nBefore we start the uninstall. Please make sure which app you want to uninstall. This procedure cant be undone." +bcolors.ENDC)16 #Here we ask the user if he really wants to uninstall apk17 print('\n' * 2)18 uninstall_app = input("Which app do you want to uninstall. Please enter the package name (like com.instagram.android) and press enter\n\n>>> ")19 print('\n' * 2)20 print("Okay, u want to uninstall:\n" , uninstall_app)21 print("I will now uninstall" , uninstall_app , "from your device in\n3...")22 time.sleep(1)23 print("2...")24 time.sleep(1)25 print("1...")26 time.sleep(1)27 def uninstall_apk():28 from ppadb.client import Client as AdbClient29 # Default is "127.0.0.1" and 503730 client = AdbClient(host="127.0.0.1", port=5037)31 devices = client.devices()32 for device in devices:33 device.uninstall(uninstall_app)34 uninstall_apk()...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Airtest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful