赞
踩
# 根据当前电脑版本找到相应合适的版本,并将inspect.exe所在的路径放到环境变量(sysdm.cpl)中
# 查看电脑系统详情信息 cmd > systeminfo
# 环境变量 cmd > sysdm.cpl > x64(具体要看windows操作系统位数)
https://developer.microsoft.com/zh-cn/windows/downloads/sdk-archive/
控件类型(ControlType)以及对应的名称(Name)常用于定位
三. pc微信公众号点击
# -*- coding: utf-8 -*-
# @Time : 2022/12/24 9:51
# @Author : Cocktail_py
import uiautomation as auto
wx_window = auto.WindowControl(Name='微信', ClassName='WeChatMainWndForPC')
# 控制的应用窗口前置
wx_window.SetTopmost(True)
wx_window.ButtonControl(Name='通讯录').Click()
wx_window.ListControl(Name="联系人").ListItemControl(Name="新的朋友").Click()
wx_window.ListControl(Name="联系人").ListItemControl(Name="公众号").Click()
for c,d in auto.WalkControl(wx_window):
if c.ControlType not in [auto.ControlType.ListItemControl]:
continue
text = c.Name
if not text:
continue
# 过滤条件
if text in ['新的朋友','公众号']:
continue
# 判断当前元素底部范围是否大于父元素底部范围
if c.BoundingRectangle.bottom >wx_window.BoundingRectangle.bottom:
auto.WheelDown(waitTime=0.01)
auto.WheelDown(waitTime=2)
print("当前点击>>{}".format(text))
c.Click()
参考
https://blog.csdn.net/xiaoqiangclub/article/details/125536942
https://blog.csdn.net/as604049322/category_11396772.html
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。