RPA對微信和企業(yè)微信的UI元素探測
元素定位原理(用.net自己寫一個試一試)
windows10 下UI自動化框架存在于下列路徑:
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2
2018/03/26 ?16:24 ? ? ? ? ? ?46,776 UIAutomationClient.dll
2018/03/26 ?16:24 ? ? ? ? ? ?28,904 UIAutomationClientsideProviders.dll
2018/03/26 ?16:24 ? ? ? ? ? ?31,424 UIAutomationProvider.dll
2018/03/26 ?16:24 ? ? ? ? ? ?39,600 UIAutomationTypes.dll
早期我們去探測windows元素用SPY++或者User32.Dll調用可以很方便的獲取到句柄
原理如下:鼠標坐標或者標題、類名
[DllImport("user32.dll", EntryPoint = "WindowFromPoint")]//指定坐標處窗體句柄
public static extern int WindowFromPoint(
int xPoint,
int yPoint
);
IntPtr hwnd = WindowFromPoint(point.X, point.Y);//獲取指定坐標處窗口的句柄
IntPtr hwnd = Win32.FindWindow(lpszClass, lpWindowName);
由于windows從System.Windows.Forms到Windows.UI.Core?很多自定義的控件出現(xiàn)了,我們無法通過句柄探測到元素。微軟的自動化dll對部分UI元素不能獲取。
下面是使用了微軟UIAutomation?中的 AutomationElement能力對企業(yè)微信進行了探測:
AutomationElement element = AutomationElement.FromPoint(new System.Windows.Point(Cursor.Position.X, Cursor.Position.Y));
通過測試無論鼠標定位在哪里,我們探測的始終為頂層菜單。
接下來我使用(影刀、Power Automate、uiBot、實在智能)RPA工具進行了微信及企業(yè)微信測試,如下結果:
acc:Windows.UI.Core.CoreWindow
whd:windowsHandle
uia:AutomationElement
cv
?影刀
?
?
?
微軟Power Automate
?
uiBot
?
?
?文章來源:http://www.zghlxwxcb.cn/news/detail-806476.html
實在智能
文章來源地址http://www.zghlxwxcb.cn/news/detail-806476.html
到了這里,關于RPA.1.桌面UI自動化RPA性能測試:影刀、微軟Power Automate、uiBot、實在智能對微信和企業(yè)微信的探測的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網!