'Run a msi with pywinauto open windows installer but not the msi I'm hopping

Why I choose pywinauto :

  • to test the installer
  • to install and uninstall faster repeatable tasks
  • collect logs
  • check if a service and 4 processus are running after the installation (and not after the uninstall)

This was working with .exe but we change the installer by WIX and now it's a msi.

So my script looks like:

from pywinauto.application import Application
from pywinauto import Desktop


path = 'C:\\Program Files (x86)\\Test\\uninstall-dev.msi'
app = Application().start(r'msiexec /i ' + path)


uninstall = Desktop(backend='win32').window(title='Test uninstall')
uninstall['Please wait while it's being uninstalled.'].wait('ready', timeout=120)
uninstall.Uninstall.click()

dlg = Desktop(backend='win32').window(title='Setup Uninstall')
dlg.OK.click()


uninstall = Desktop(backend='win32').window(title='Setup Uninstall ')

uninstall.ShowDetails.click()
uninstall.Next.wait('ready', timeout=120)
uninstall.Next.click()
uninstall.Finish.click()

I tried too :

 app = Application().start(r'msiexec.exe /i ' + path)

and

 app = Application().start(r'msiexec.exe /i ...msi' + path)

When I run it, I get : enter image description here

If I run in cmd line :

msiexec /i C:\\Program Files (x86)\\Test\\uninstall-dev.msi

it's working as expected : the installer I created is running.

It's not my installer. Why Do I get this behavior?

thanks



Solution 1:[1]

To fix it, use :

path = '"C:\\Program Files (x86)\\Test\\uninstall-dev.msi"'
app = Application().start('msiexec.exe /i ' + path)

Don't use simple quote, use two between the path

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Bob