Best Python code snippet using Airtest
cv.py
Source:cv.py
...153 def _imread(self):154 return aircv.imread(self.filepath)155 def _find_all_template(self, image, screen):156 return TemplateMatching(image, screen, threshold=self.threshold, rgb=self.rgb).find_all_results()157 def _find_keypoint_result_in_predict_area(self, func, image, screen):158 if not self.record_pos:159 return None160 # calc predict area in screen161 image_wh, screen_resolution = aircv.get_resolution(image), aircv.get_resolution(screen)162 xmin, ymin, xmax, ymax = Predictor.get_predict_area(self.record_pos, image_wh, self.resolution, screen_resolution)163 # crop predict image from screen164 predict_area = aircv.crop_image(screen, (xmin, ymin, xmax, ymax))165 if not predict_area.any():166 return None167 # keypoint matching in predicted area:168 ret_in_area = func(image, predict_area, threshold=self.threshold, rgb=self.rgb)169 # calc cv ret if found170 if not ret_in_area:171 return None...
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!!