赞
踩
import uiautomation as auto
import time
wechatWindow = auto.WindowControl(searchDepth=1,className=‘WeChatMainWndForPC’,Name=‘微信’)
button = wechatWindow.ButtonControl(Name=‘通讯录’)
button.Click()
search = wechatWindow.EditControl(Name=‘搜索’)
search.Click()
search.GetParentControl().GetChildren()[1].SendKeys(“就”)
searResult = wechatWindow.ListControl(Name=‘搜索结果’).GetChildren()
for sear in searResult:
print(sear.Name)
if sear.Name == “就”:
sear.Click()
break
session = wechatWindow.ListControl(Name=“会话”)
wechatWindow.ButtonControl(Name=‘就’)
button =wechatWindow.ButtonControl(Name=‘聊天信息’)
wechatWindow.EditControl(Name=“输入”).SendKeys(“你好”)
sendBtn = wechatWindow.ButtonControl(Name=‘sendBtn’)
sendBtn.Click()
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。