# -*- coding: utf-8 -*- # @Author: wangkun # @Time: 2023/2/20 import time import atomac class SearchKey: @classmethod def start_wechat(cls): # 启动应用并获取应用信息 bundle_id = "com.tencent.xinWeChat" atomac.launchAppByBundleId(bundle_id) automator = atomac.getAppRefByBundleId(bundle_id) time.sleep(3) # 获取当前应用window window = automator.windows()[0] print(f"当前应用window:{window}") msg_box = window.findFirstR(AXRole="AXCell", AXIdentifier="MMChatsTableCellView_0") print(msg_box.getAttributes()) if __name__ == "__main__": SearchKey.start_wechat()