使用pywinauto点击对话框取消按钮

Using pywinauto to click dialog box Cancel button

我的情况是,如果将受密码保护的 .ppt 文件传递​​给 PowerPoint 的自动化进程,它就会挂起。我已经编写了一个脚本来检测何时使用 pywinauto 并连接到密码对话框,但我似乎无法让它单击取消按钮。

这是我在“输入密码”对话框中看到的控件标识符:

NUIDialog - 'Password'    (L649, T422, R999, B553)
['NUIDialog', 'Password', 'PasswordNUIDialog']
child_window(title="Password", class_name="NUIDialog")
   |
   | NetUIHWND - ''    (L657, T453, R991, B545)
   | ['NetUIHWND', 'PasswordNetUIHWND']
   | child_window(class_name="NetUIHWND")
   |    |
   |    | NetUICtrlNotifySink - ''    (L728, T495, R983, B510)
   |    | ['PasswordNetUICtrlNotifySink', 'NetUICtrlNotifySink']
   |    | child_window(class_name="NetUICtrlNotifySink")
   |    |    |
   |    |    | RICHEDIT60W - ''    (L728, T495, R983, B510)
   |    |    | ['PasswordRICHEDIT60W', 'RICHEDIT60W']
   |    |    | child_window(class_name="RICHEDIT60W")
   |    |
   |    | RICHEDIT60W - ''    (L728, T495, R983, B510)
   |    | ['PasswordRICHEDIT60W', 'RICHEDIT60W']
   |    | child_window(class_name="RICHEDIT60W")
   |
   | NetUICtrlNotifySink - ''    (L728, T495, R983, B510)
   | ['PasswordNetUICtrlNotifySink', 'NetUICtrlNotifySink']
   | child_window(class_name="NetUICtrlNotifySink")
   |    |
   |    | RICHEDIT60W - ''    (L728, T495, R983, B510)
   |    | ['PasswordRICHEDIT60W', 'RICHEDIT60W']
   |    | child_window(class_name="RICHEDIT60W")
   |
   | RICHEDIT60W - ''    (L728, T495, R983, B510)
   | ['PasswordRICHEDIT60W', 'RICHEDIT60W']
   | child_window(class_name="RICHEDIT60W")

我试过 password_dialog.NetUICtrlNotifySink.Click() 但没有任何反应。有什么想法吗?

我建议对所有 MS Office 产品使用 Application(backend="uia")。它应该会看到更多控件。