Best Python code snippet using Airtest
android.py
Source:android.py
...63 Returns:64 None65 """66 return self.adb.start_app(package, activity)67 def start_app_timing(self, package, activity):68 """69 Start the application and activity, and measure time70 Args:71 package: package name72 activity: activity name73 Returns:74 app launch time75 """76 return self.adb.start_app_timing(package, activity)77 def stop_app(self, package):78 """79 Stop the application80 Args:81 package: package name82 Returns:83 None84 """85 return self.adb.stop_app(package)86 def clear_app(self, package):87 """88 Clear all application data89 Args:90 package: package name...
场景七-正餐循环点餐.py
Source:场景七-正餐循环点餐.py
...5from poco.drivers.android.uiautomation import AndroidUiautomationPoco6auto_setup(__file__)7# stop_app("com.yhbc.yhz.dinner")89# # start_app_timing("com.yhbc.yhz.dinner","com.yhbc.tablet.ui.main.MainActivity")10# start_app("com.yhbc.yhz.dinner",activity=None)11poco = AndroidUiautomationPoco(use_airtest_input=True, screenshot_each_action=False)12loop_num=1 #循ç¯æ¬¡æ°13for i in range(loop_num):14 i=i+115 print("åèæ¬ä¸å¾ªç¯æ¬¡æ°i="+str(i))1617 # 顾客Aæä½ 18 touch(Template(r"tpl1551064173368.png", record_pos=(-0.469, -0.147), resolution=(1366, 768)))19 touch(Template(r"tpl1551064196965.png", record_pos=(0.041, -0.093), resolution=(1366, 768)))2021 sleep(2.0)22 touch(Template(r"tpl1551064219936.png", record_pos=(-0.004, -0.07), resolution=(1366, 768)))23 touch(Template(r"tpl1551064240675.png", record_pos=(0.001, 0.102), resolution=(1366, 768)))
...
adb_startapp_time.py
Source:adb_startapp_time.py
...12while(Count < 12):13 if new:14 # æ°å®è£
é¦æ¬¡å¯å¨15 install("C:/Users/cucumber/Desktop/thevoiceRelease-minApi21-armeabi-v7a-82730001-2019-01-11-08-46.apk")16 A = Android().start_app_timing("com.starmakerinteractive.thevoice","com.ushowmedia.starmaker.activity.SplashActivity")17 print(A)18 TimeList.append(A)19 uninstall("com.starmakerinteractive.thevoice")20 Count = Count + 121 print(Count)22 else:23 # ----------------24 # éé¦æ¬¡å®è£
å·å¯å¨25 A = Android().start_app_timing("com.starmakerinteractive.thevoice","com.ushowmedia.starmaker.activity.SplashActivity")26 print(A)27 TimeList.append(A)28 Count = Count + 129 print(Count)30 clear_app("com.starmakerinteractive.thevoice")31# æå°æµè¯æ°æ®...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!