Best Python code snippet using Airtest
profile_recorder.py
Source:profile_recorder.py
...149 "kp_src": len(kp_src),150 "good": len(good)}151 self.method_exec_info.append(ret_info)152 self.record_thread.stop_flag = True153 def wite_to_json(self, dir_path="", file_name=""):154 """å°æ§è½æ°æ®åå
¥æ件."""155 # æåæ°æ®156 data = {157 "plot_data": self.record_thread.profile_data,158 "method_exec_info": self.method_exec_info,159 "search_file": self.search_file,160 "source_file": self.source_file}161 # åå
¥æ件162 file_path = os.path.join(dir_path, file_name)163 if not os.path.exists(dir_path):164 os.makedirs(dir_path)165 json.dump(data, open(file_path, "w+"), indent=4)166def main():167 # æªå±[2907, 1403] æªå¾[1079, 804]168 search_file = "sample\\high_dpi\\tpl1551940579340.png"169 screen_file = "sample\\high_dpi\\tpl1551944272194.png"170 # åå¤æ§è½æ°æ®è®°å½171 profiler = ProfileRecorder(0.05)172 profiler.load_images(search_file, screen_file)173 profiler.profile_methods(["kaze", "brisk", "akaze", "orb", "sift", "surf", "brief"])174 profiler.wite_to_json(dir_path="result", file_name="high_dpi.json")175if __name__ == '__main__':...
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!!