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