Search code examples
python-3.xpywinauto

How do deal with Installshield installations that extract an MSI with pywinauto?


I am trying to automate an installation that starts out with an InstallShield setup.exe. That kicks off the installation of a MS Visual C++ redistributable. That leads to an error about Adobe Flash not being up to date. I have asked about how to deal with that here:

Error during automated software install using pywinauto

Once I click OK for the Adobe dialog(have to use pyautogui.click() for this for now) I see that there is an .msi being extracted. I have followed the install and it puts it into a new Temp folder under my Users\AppData directory.

How do you get pywinauto to find this new application? I have tried using

adobe = Application().connect(title_re="MyInstaller",class_name="#32770", visible_only=True)

And then try to print_control_identifiers() but get this error:

AttributeError: Neither GUI element (wrapper) nor wrapper method 'print_control_identifiers' were found (typo?)

I have checked Spy++ and Inspect and AutoIT to find the class which I can. I can't use the procid as it will always change.

Any thoughts on how to attach to the .msi process so I can then connect() to it?

Edit: Is there a way to regex pywinauto to point to a path if I know where MyProgram.msi is? It seems to be in C:\Users\me\AppData\Local\Temp{xxx}\MyProgram.msi as I found several copies there. Thanks!


Solution

  • Add timeout=10 or whatever you need to connect() params. Current default timeout is zero, but it should be timings.Timings.window_find_timeout which is 5 sec by default.

    Auto detection of spawned child process is planned for next major release (as well as default timeout fix).

    For running an unpacked .msi file you need msiexec standard Windows command in method .start(). Play with it in cmd.exe manually first starting from msiexec /?.