我尝试自动化的应用程序有一个功能区栏,当我在相关的功能区上执行print_control_identifiers时,我看不到任何控件暴露。有没有办法在功能区内自动控制?
非常感谢任何帮助
Toolbar - '' (L0, T0, R1920, B143)
['Toolbar', '']
child_window(auto_id="59398", control_type="ToolBar")
Inspect.exe
How found: Selected from tree...
Name: ""
ControlType: UIA_ToolBarControlTypeId (0xC365)
LocalizedControlType: "tool bar"
BoundingRectangle: {l:0 t:0 r:1920 b:143}
ClassName: "Afx:RibbonBar:400000:8:10003:10"
HelpText: "ControlPane"
鼠标在功能区上移动
How found: Mouse move (593,98)
hwnd=0x00000000001703B8 32bit class="Afx:RibbonBar:400000:8:10003:10" style=0x54002800 ex=0x0
Name: ""
ControlType: UIA_ToolBarControlTypeId (0xC365)
LocalizedControlType: "tool bar"
AutomationId: "59398"
FrameworkId: "Win32"
ClassName: "Afx:RibbonBar:400000:8:10003:10"
NativeWindowHandle: 0x1703B8
ProviderDescription: "[pid:5348,hwnd:0x1703B8 Main:Nested [pid:3852,hwnd:0x1703B8 Main(parent link):Microsoft: MSAA Proxy (unmanaged:uiautomationcore.dll)]; Hwnd(parent link):Microsoft: HWND Proxy (unmanaged:uiautomationcore.dll)]"
鼠标在控件上移动
How found: Mouse move (31,89)
hwnd=0x00000000001703B8 32bit class="Afx:RibbonBar:400000:8:10003:10" style=0x54002800 ex=0x0
Name: "Create"
ControlType: UIA_ButtonControlTypeId (0xC350)
LocalizedControlType: "button"
AccessKey: "Alt, H, C"
ProcessId: 3852
ProviderDescription: "[pid:3852,hwnd:0x0 Main(parent link):Microsoft: MSAA Proxy (unmanaged:uiautomationcore.dll)]"
LegacyIAccessible.DefaultAction: "Press"
LegacyIAccessible.Description: "Create a new batch"
LegacyIAccessible.Help: ""
LegacyIAccessible.KeyboardShortcut: "Alt, H, C"
LegacyIAccessible.Name: "Create"
LegacyIAccessible.Role: push button (0x2B)
LegacyIAccessible.State: focusable (0x100000)
答案 0 :(得分:0)
backend="uia"
的解决方法在pywinauto==0.6.6
中实现。因此,工具栏方法.button('Button name')
应该返回包装器以获取正确的UI元素。可能只剩下一个问题:菜单栏中的下拉菜单项尚无法自动化。一级按钮/菜单项现在可以自动化。