使用 pywinauto 打开 Windows 安装程序运行 msi,但不是我想要的 msi
为什么我选择 pywinauto :
- 测试安装程序
- 以安装和卸载更快的可重复任务
- 收集日志
- 检查安装后(而不是卸载后)是否正在运行服务和 4 个进程
这与 .exe 一起使用,但我们通过 WIX 更改了安装程序现在它是一个微星。
所以我的脚本看起来像:
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()
我也尝试过:
app = Application().start(r'msiexec.exe /i ' + path)
当
app = Application().start(r'msiexec.exe /i ...msi' + path)
如果我在 cmd 行中运行:
msiexec /i C:\\Program Files (x86)\\Test\\uninstall-dev.msi
它按预期工作:我创建的安装程序正在运行。
这不是我的安装程序。为什么我会出现这种行为?
谢谢
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)
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要修复此问题,请使用:
不要使用简单的引号,在路径之间使用两个引号
To fix it, use :
Don't use simple quote, use two between the path