“文章所涉及內(nèi)容更多來(lái)自網(wǎng)絡(luò),在此聲明,并感謝知識(shí)的貢獻(xiàn)者!”
UI自動(dòng)化—UI編程包括但不限于UI界面的開(kāi)發(fā),UI界面的測(cè)試。而本系列文章的主要側(cè)重于UI界面的自動(dòng)化操作。通過(guò)一段代碼實(shí)現(xiàn)電腦自行點(diǎn)擊、打開(kāi)某文件或者修改某進(jìn)程的操作。
【資料圖】
UI控件識(shí)別—
UiSpy 下載
(23條消息) windows 技術(shù)篇 - uispy 工具獲取和使用,windows窗口屬性快捷查看工具_(dá)掙扎的藍(lán)藻的博客-CSDN博客_uispy
https://blog.csdn.net/qq_38161040/article/details/105491034
FlatUInspect 源碼下載
https://github.com/FlaUI/FlaUInspect
FlatUInspect編譯運(yùn)行
FlatUInspect 使用說(shuō)明
https://zhuanlan.zhihu.com/p/563909940?utm_id=0
FlatUInspect 微信控件層次
控件識(shí)別工具Inspect.exe下載
https://www.shuzhiduo.com/A/6pdDZNkDJw/
Window Inspector 下載
https://www.jb51.net/softs/457644.html
locale庫(kù)—
import locale
#獲取系統(tǒng)語(yǔ)言
if (locale.getdefaultlocale()[0] =="zh_CN"):
pass
subprocess庫(kù)—
啟動(dòng)程序
import subprocess
subprocess.Popen("3dmark-setup.exe")
Uiautomation庫(kù)—
查找物件:
1、WindowContrl(searchDepth,ClassName,SubName) 查找窗口中的程序,如果有中文則需用Unicode;可用window.Exists(maxSearchSeconds)來(lái)判斷此窗口是否存在;
2、EditControl(searchFromControl) 查找編輯位置,找到后可用DoubleClick()來(lái)改變電腦的focus;edit.SetValue("string")輸入值;
3、MenuItemControl(searchFromControl,Name) 查找菜單按鈕;
4、ComboBoxControl(searchFromControl,AutomationI) 查找下拉框,然后在此基礎(chǔ)上用Select("name")方法來(lái)選擇需要的選項(xiàng);
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
點(diǎn)擊操作:
單擊:.Click()
雙擊:.DoubleClick()
Click() 點(diǎn)擊;
RighClik() 右鍵點(diǎn)擊;
DoubleClick()
SendKeys() 發(fā)送字符;
SetValue() 傳值,一般對(duì)EditControl用;
Win32API.SendKeys("string") 如果已在編輯位置,則可用此方法來(lái)輸入值,{Ctrl}為ctrl鍵,其他類似;{@ 8}格式可輸入8個(gè)@,對(duì)于數(shù)字也可實(shí)現(xiàn)此功能,但對(duì)于字母不能...;
切換窗口
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") 用進(jìn)程打開(kāi)程序;
window.Close() 關(guān)閉窗口;
window.SetActive() 使用;
window.SetTopMost() 設(shè)置為頂層
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,打開(kāi)控制臺(tái)
automation.Logger.ColorfulWriteLine("\nIwill open
automation.ShowDesktop() 顯示桌面;
微信自動(dòng)化—
獲取好友列表
https://zhuanlan.zhihu.com/p/474166048
獲取微信好友名單,可指定標(biāo)簽 & 全部
https://gitcode.net/mirrors/Frica01/Wechat_mass_msg?utm_source=csdn_github_accelerator
微信好友列表獲?。ù鎯?chǔ)到txt中)
https://blog.csdn.net/m0_67391377/article/details/126065428
python基于pywinauto實(shí)現(xiàn)PC端自動(dòng)化 python操作微信自動(dòng)化
https://blog.51cto.com/u_15354476/3767938
微信群發(fā)消息,獲取群通訊錄名單
https://www.fdsml.com/zh/438398.html
Python 實(shí)現(xiàn)獲取微信好友信息
https://www.cnblogs.com/swjian/p/10597690.html
微信好友列表獲取
https://www.pudn.com/news/62e3f4b5864d5c73ac26b03a.html
自動(dòng)發(fā)送微信消息
參考資料—
(23條消息) Python UI自動(dòng)化 編程(一) UIAutomation_OKKLES的博客-CSDN博客_uiautomation
https://blog.csdn.net/weixin_43393800/article/details/119105108
Python使用uiautomation實(shí)現(xiàn)Windows平臺(tái)自動(dòng)化 - 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
開(kāi)源自己用python封裝的一個(gè)Windows GUI(UIAutomation)自動(dòng)化工具,支持MFC,WindowsForms,WPF,Metro,Qt - YinKaisheng - 博客園 (cnblogs.com)
https://www.cnblogs.com/Yinkaisheng/p/3444132.html
桌面應(yīng)用自動(dòng)化python——uiautomation API 如何找元素 - 白灰 - 博客園 (cnblogs.com)
https://www.cnblogs.com/baihuitestsoftware/articles/9340462.html
UIAutomation使用(一) -蝸牛學(xué)苑 (woniuxy.cn)
https://www.woniuxy.cn/article/253
用開(kāi)源uiautomation自動(dòng)化操作火狐 - 知乎 (zhihu.com)
https://zhuanlan.zhihu.com/p/30409594
Python下編寫(xiě)Windows自動(dòng)化測(cè)試軟件 - 簡(jiǎn)書(shū) (jianshu.com)
https://www.jianshu.com/p/be3c46c7a905
python:獲取微信好友列表信息(二)進(jìn)行導(dǎo)出微信好友到csv數(shù)據(jù)讀取與處理
https://blog.csdn.net/seoyundu/article/details/81543756
Copyright @ 2015-2022 亞洲晚報(bào)網(wǎng)版權(quán)所有 備案號(hào): 豫ICP備20022870號(hào)-9 聯(lián)系郵箱:553 138 779@qq.com