| 7 | # 2. 自定义一个脚本类,继承 AndroidBotMain |
| 8 | # 2. Customize a script class and inherit AndroidBotMain |
| 9 | class CustomAndroidScript(AndroidBotMain): |
| 10 | |
| 11 | # 2.1. 设置是否终端打印输出 DEBUG :输出, INFO :不输出, 默认打印输出 |
| 12 | # 2.1. Set whether the terminal prints output DEBUG: output, INFO: no output, and print output by default |
| 13 | Log_Level = "DEBUG" |
| 14 | Websocket_Log_Level = "DEBUG" |
| 15 | |
| 16 | # 2.2. 终端打印信息是否存储LOG文件 True: 储存, False:不存储 |
| 17 | # 2.2. Does the terminal print information store the LOG file? True: yes, False: no |
| 18 | Log_Storage = True |
| 19 | |
| 20 | # 2.3. 注意:script_main 此方法是脚本执行入口必须存在此方法 |
| 21 | # 2.3. Note: script_main This method must exist in the script execution portal |
| 22 | def script_main(self): |
| 23 | # 显示手机最近任务列表 |
| 24 | # Displays the list of recent tasks of the mobile phone |
| 25 | result = self.recent_tasks() |
| 26 | print(result) |
| 27 | |
| 28 | |
| 29 | # 主函数死循环时手机app连接断开异常捕获跳出死循环demo示例代码 |
| 30 | # while True: |
| 31 | # try: |
| 32 | # # 死循环中必须加入aibote函数代码 |
| 33 | # self.get_installed_packages() |
| 34 | # print("我是个死循环") |
| 35 | # time.sleep(2) |
| 36 | |
| 37 | # # 服务端捕获客户端断开异常跳出线程循环结束连接 |
| 38 | # except OSError as e: |
| 39 | # break |
| 40 | |
| 41 | # # 捕获其他非连接断开异常 |
| 42 | # except Exception as e: |
| 43 | # print(e) |
| 44 | |
| 45 | |
| 46 |
nothing calls this directly
no outgoing calls
no test coverage detected