enhancementhelp wanted
描述
There needs to be a way to save existing application structures so that it's possible to avoid boilerplate code that drills down into an object hierarchy.
For example, instead of doing this:
def saveFile(file):
app = pywinauto.Application(backend='uia')
appconnect = app.connect(path='sldworks.exe')
window = appconnect.window()
window.set_focus()
button = window.child_window("Save")
#This won't work but you get the idea
wrapper = input.wrapper_object()
wrapper.sendkeys(file)
button.click()
We could instead do something more along the lines of this:
def saveFile(file):
TestedApps().SolidWorks.dlgSaveAs.Edit.SetText(file)
TestedApps().SolidWorks.dlgSaveAs.btnSave.Click()
This would enable auto completion in IDEs like PyCharm so that it would be possible to write entire scripts without opening the tested application and feeling out the correct properties and windows to search for.
Several test runners already do something like this with XML mapping to build a pre-defined object model. The biggest ones that I am familiar with are TestComplete and the GUI automation already built into Visual Studio Enterprise. In both instances, they call it a name map.