如何使用Pywinauto在Windows应用程序中选择图标

时间:2012-04-17 18:10:11

标签: click icons simulate pywinauto

我正在尝试模拟Windows应用程序上的图标点击。 目前,我只能使用ClickInput模拟鼠标点击(coords =(x,y)) 上述方法的问题在于,无论软件UI何时更新,其位置都会发生变化,这会迫使我根据新的图标位置更新所有脚本。

有没有办法模拟工具条中的图标点击而不使用coords?

1 个答案:

答案 0 :(得分:0)

是的!据我所知,Static中的图片看起来像pywinauto

Access names : ['Static4']
Class : Static
ClientRects : [<RECT L0, T0, R24, B24>]
ContextHelpID : 0
ControlCount : 0
ControlID : 269
ExStyle : 4
Fonts : [<LOGFONTW 'MS Shell Dlg' -11>]
FriendlyClassName : Static
handle : 2097378
Image : <Image._ImageCrop image mode=RGB size=24x24 at 0x1E47DC8>
IsEnabled : True
IsUnicode : True
IsVisible : True
MenuItems : []
pwa_type : <class 'pywinauto.controls.win32_controls.StaticWrapper'>
Rectangle : (L514, T498, R538, B522)
Style : 1342179331
Texts : ['']
UserData : 0

您可以轻松访问

window['Static4'].Click()