# -*- 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 = automator.windows()[0] msg_box = window.findFirstR(AXRole="AXCell", AXIdentifier="MMChatsTableCellView_0") print(msg_box.getAttributes()) if __name__ == "__main__": SearchKey.start_wechat()