我是Python和Pywinauto的新手。我正在尝试自动卸载使用InstallShield的程序。我已经了解到它将打开程序和功能,单击卸载,然后打开installshield向导窗口,但是在卸载确认中单击“是”失败。我确定TestAppInstaller部分中缺少一些基本内容:
from __future__ import print_function
import pywinauto
pywinauto.Application(backend="win32").start(r'explorer.exe')
explorer = pywinauto.Application(backend="win32").connect(path='explorer.exe', timeout=20)
# Go to "Control Panel -> Programs and Features"
NewWindow = explorer.window(top_level_only=True, active_only=True, class_name='CabinetWClass')
try:
NewWindow.AddressBandRoot.click_input()
NewWindow.type_keys(r'Control Panel\Programs\Programs and Features{ENTER}', with_spaces=True, set_foreground=False)
ProgramsAndFeatures = explorer.window(top_level_only=True, active_only=True, title='Programs and Features', class_name='CabinetWClass')
item_TestApp = ProgramsAndFeatures.FolderView.get_item('MIU Agent')
item_TestApp.ensure_visible()
item_TestApp.click_input(button='right', where='icon')
explorer.PopupMenu.menu_item('Uninstall').click_input()
TestAppInstaller = explorer.window(title='Test App - InstallShield Wizard', class_name='#32770', active_only=True)
if TestAppInstaller.exists():
Confirmation.Yes.click_input(timeout=20, retry_interval=0.5)
TestAppInstaller.wait('visible')
finally:
NewWindow.close()
InstallShield的图像供参考: InstallShield1 InstallShield2
任何帮助将不胜感激!