search_key_mac.py 555 B

1234567891011121314151617181920212223242526
  1. # -*- coding: utf-8 -*-
  2. # @Author: wangkun
  3. # @Time: 2023/2/20
  4. import time
  5. import atomac
  6. class SearchKey:
  7. @classmethod
  8. def start_wechat(cls):
  9. bundle_id = "com.tencent.xinWeChat"
  10. atomac.launchAppByBundleId(bundle_id)
  11. automator = atomac.getAppRefByBundleId(bundle_id)
  12. time.sleep(3)
  13. window = automator.windows()[0]
  14. msg_box = window.findFirstR(AXRole="AXCell", AXIdentifier="MMChatsTableCellView_0")
  15. print(msg_box.getAttributes())
  16. if __name__ == "__main__":
  17. SearchKey.start_wechat()