I was trying to automate the SAP windows GUI application.
I have installed the python 2.4 with pywinauto 0.3.7 along with Ctypes and Sendkeys. Setup was successful and example was running efficiently.
When I tried to open a SAP window, now i am confused how to get the name of the window and also the objects in that window so that we can use the properties of the same to automate the application.
Like we do in commericial vendor based software we have a object repository in QTP and GUI Map files in winrunner which can specify what is the window prop or objects in that window, but when using pywinauto how to do the same.
I also have similar problems with SAP application ….
Using this code, I get the application … but I can't see any control …
from pywinauto import application
app = application.Application.start("C:\\WINDOWS\\SAPwksta\\setup\\SapStart.exe -sal=\"C:\\WINDOWS\\SAPwksta\\setup\\SAL\\SapLogon.sal\"")
and I got this error:
Traceback (most recent call last):
File "sap_test.py", line 4, in <module>
File "pywinauto\application.py", line 986, in top_window_
criteria = windows
IndexError: list index out of range
You have spotted a bug in Pywinauto - though it only occurs when there are no windows for the process.
I have fixed the code - it will now raise a runtime error when there are no windows available. (which will not be an awful lot better for you - but at least the message will be clearer).
I think you need to verify that the process you start is the one that has the application, for example if SAP opens up a 2nd process for the UI - then you will need to connect to it rather than starting it (i.e. start it through an os.system call or similar - and then use Application.Connect() afterwards.
Hope this helps,
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.