1

I need to automate installation process of some product, but it has to be exactly installation through passing InstallAnywhere wizard (it's kinda GUI testing of installation process, so silent install won't work). Any suggestion how to do this?

I guess the main problem is that installation file (*.exe) is just extractor which extract required files to temp folder and then run java application.

4

1 回答 1

0

您可以尝试pywinauto在 Windows 上进行测试。安装程序的 Java 部分可能需要新的“UIA”后端,该后端将在 3 月发布。对于早期测试,您可以尝试以下步骤:

  1. 安装pyWin32comtypespip install pypiwin32pip install comtypes. _
  2. 安装pywinauto的UIA 分支python setup.py install

试试下面的代码:

import pywinauto
pywinauto.backend.activate('uia')

app = pywinauto.Application().start('your_installer_path.exe')
app.ApproximateMainWindowName.Wait('ready', timeout=15)
app.ApproximateMainWindowName.PrintControlIdentifiers()

PrintControlIdentifiers输出是进一步步骤的提示。窗口上的控件有可能的访问名称。现在只有基本功能ClickInput()TypeKeys('something')应该可以工作。

可以在此处建议控制的可用方法:

app.MainWindow.OKButton.WrapperObject(). # methods list can be displayed here in IDLE or Visual Studio Python Tools
app.MainWindow.OKButton.WrapperObject().ClickInput() # code for debugging
#app.MainWindow.OKButton.ClickInput() # it works the same way, for production code

如果某些东西不起作用,请随时寻求更多帮助。

Python 脚本可能需要以管理员身份运行才能访问 GUI。或者为 python.exe 添加清单,使用uiAccess="true".

于 2016-02-02T10:34:31.153 回答