首页 > 滚动

天天热资讯!#Uiautomation# 基于Uiautomation的微信自动化

人民网 原创稿 2023-01-12 14:04:01

“文章所涉及内容更多来自网络,在此声明,并感谢知识的贡献者!”

UI自动化—

UI编程包括但不限于UI界面的开发,UI界面的测试。而本系列文章的主要侧重于UI界面的自动化操作。通过一段代码实现电脑自行点击、打开某文件或者修改某进程的操作。

UI控件识别


(资料图片仅供参考)

UiSpy 下载

(23条消息) windows 技术篇 - uispy 工具获取和使用,windows窗口属性快捷查看工具_挣扎的蓝藻的博客-CSDN博客_uispy

https://blog.csdn.net/qq_38161040/article/details/105491034

FlatUInspect 源码下载

https://github.com/FlaUI/FlaUInspect

FlatUInspect编译运行

FlatUInspect 使用说明

https://zhuanlan.zhihu.com/p/563909940?utm_id=0

FlatUInspect 微信控件层次

控件识别工具Inspect.exe下载

https://www.shuzhiduo.com/A/6pdDZNkDJw/

Window Inspector 下载

https://www.jb51.net/softs/457644.html

locale库

import locale

#获取系统语言

if (locale.getdefaultlocale()[0] =="zh_CN"):

pass

subprocess库

启动程序

import subprocess

subprocess.Popen("3dmark-setup.exe")

Uiautomation库

查找物件:

1、WindowContrl(searchDepth,ClassName,SubName) 查找窗口中的程序,如果有中文则需用Unicode;可用window.Exists(maxSearchSeconds)来判断此窗口是否存在;

2、EditControl(searchFromControl) 查找编辑位置,找到后可用DoubleClick()来改变电脑的focus;edit.SetValue("string")输入值;

3、MenuItemControl(searchFromControl,Name) 查找菜单按钮;

4、ComboBoxControl(searchFromControl,AutomationI) 查找下拉框,然后在此基础上用Select("name")方法来选择需要的选项;

5、BottonControl(searchFromControl,Name,SubName) 查找按钮;

6、automation.FindControl(firefoxWindow,

lambdac:(isinstance(c, automation.EditControl) or isinstance(c,automation.ComboBoxControl)) and c.Name == "Enter your search term") 按条件搜索handle

点击操作:

单击:.Click()

双击:.DoubleClick()

Click() 点击;

RighClik() 右键点击;

DoubleClick()

SendKeys() 发送字符;

SetValue() 传值,一般对EditControl用;

Win32API.SendKeys("string") 如果已在编辑位置,则可用此方法来输入值,{Ctrl}为ctrl键,其他类似;{@ 8}格式可输入8个@,对于数字也可实现此功能,但对于字母不能...;

切换窗口

import uiautomation as auto

window=auto.WindowControl(ClassName="CabinetWClass",searchDepth=1) #控制面板窗口

window.SwitchToThisWindow() # 切换窗口

窗口最大化:

window =auto.WindowControl(ClassName="CabinetWClass", searchDepth=1)

window.Maximize()

窗口操作

subprocess.Popen("Name")   用进程打开程序;

window.Close()         关闭窗口;

window.SetActive()     使用;

window.SetTopMost()     设置为顶层

window.ShowWindow(uiautomation.ShowWindow.Maximize) 窗口最大化

window.CaptureToImage("Notepad.png") 截图;

uiautomation.Win32API.PressKey(uiautomation.Keys.VK_CONTROL) 按住Ctrl键

uiautomation.Win32API.ReleaseKey(uiautomation.Keys.VK_CONTROL)释放Ctrl键

automation.GetConsoleWindow() #return console window that runs python,打开控制台

automation.Logger.ColorfulWriteLine("\nIwill open Notepad andautomate it. Please wait for a while.") 控制台传值(彩色字体),普通传值用WriteLine;

automation.ShowDesktop() 显示桌面;

微信自动化

获取好友列表

https://zhuanlan.zhihu.com/p/474166048

获取微信好友名单,可指定标签 & 全部

https://gitcode.net/mirrors/Frica01/Wechat_mass_msg?utm_source=csdn_github_accelerator

微信好友列表获取(存储到txt中)

https://blog.csdn.net/m0_67391377/article/details/126065428

python基于pywinauto实现PC端自动化 python操作微信自动化

https://blog.51cto.com/u_15354476/3767938

微信群发消息,获取群通讯录名单

https://www.fdsml.com/zh/438398.html

Python 实现获取微信好友信息

https://www.cnblogs.com/swjian/p/10597690.html

微信好友列表获取

https://www.pudn.com/news/62e3f4b5864d5c73ac26b03a.html

自动发送微信消息

参考资料

(23条消息) Python UI自动化 编程(一) UIAutomation_OKKLES的博客-CSDN博客_uiautomation

https://blog.csdn.net/weixin_43393800/article/details/119105108

Python使用uiautomation实现Windows平台自动化 - ooops! - 博客园 (cnblogs.com)

https://www.cnblogs.com/jyang/p/11679828.html

(23条消息) python UIAutomator2使用教程_Jepson2017的博客-CSDN博客_uiautomator2

https://blog.csdn.net/d1240673769/article/details/113809889

开源自己用python封装的一个Windows GUI(UIAutomation)自动化工具,支持MFC,WindowsForms,WPF,Metro,Qt - YinKaisheng - 博客园 (cnblogs.com)

https://www.cnblogs.com/Yinkaisheng/p/3444132.html

桌面应用自动化python——uiautomation API 如何找元素 - 白灰 - 博客园 (cnblogs.com)

https://www.cnblogs.com/baihuitestsoftware/articles/9340462.html

UIAutomation使用(一) -蜗牛学苑 (woniuxy.cn)

https://www.woniuxy.cn/article/253

用开源uiautomation自动化操作火狐 - 知乎 (zhihu.com)

https://zhuanlan.zhihu.com/p/30409594

Python下编写Windows自动化测试软件 - 简书 (jianshu.com)

https://www.jianshu.com/p/be3c46c7a905

python:获取微信好友列表信息(二)进行导出微信好友到csv数据读取与处理

https://blog.csdn.net/seoyundu/article/details/81543756

上一篇 下一篇
热文推荐 更多

天天热资讯!#Uiautomation# 基于Uiautomation的微信自动化

2023-01-12

9地获批内外贸一体化试点

2023-01-12

真喜剧人!武大靖说能把照片颜色调一下吗害怕-每日快看

2023-01-12

全球快消息!有意思小周刊(2023.01.09):一文详解|影响成长的关键思考

2023-01-12

毕节:聚焦重点推进教育高质量发展

2023-01-11

23华能水电GN002票面利率为2.1500%

2023-01-11

共享充电宝告别“1元时代”24小时收费价差20元

2023-01-09

每日观点:华铁应急(603300.SH):发行可转债的申请获证监会受理

2022-12-07

水发燃气:中石化是公司LNG业务和城镇燃气业务的主要供应商-环球视点

2022-12-06

贵州关岭开展就业技能培训 提高培训工作精准度

2022-09-16

宜州区实现乡镇“一枚印章管审批” 进一步减少群众跑动次数

2022-08-29

想挑这个日子去登记结婚?深圳市民政局提醒尽量避开高峰日

2022-05-20

安心消费呼唤监管亮出科技之剑

2022-03-18

陕西榆林:念好乡村振兴“小康经”

2022-03-18

2月份70个大中城市商品住宅销售价格环比上涨

2022-03-18

福建推出大武夷职工康养卡 打造职工疗休养新时尚

2022-03-18

石家庄订单式服务让石工大讲堂“火”了

2022-03-18

用人单位用“盲盒岗位”招聘引发公众热议

2022-03-18

金稳委重磅发声 共同维护资本市场稳定发展

2022-03-18

我是农民 也是“飞手”:数字经济下乡村的新图景

2022-03-18