#16 In app.A.ChildWindow(parent = handle) parent is overwritten

open
nobody
None
5
2013-01-07
2013-01-07
Anonymous
No

For example I have the code:

app = application.Application()
app.start_(r"mmc.exe ServerManager.msc", timeout=10)

time.sleep(10)

app.connect_(title = "Server Manager")

a = app.ServerManager.ChildWindow(title_re = ".+Multiple CAs can be.+")

#Now I need to find particular child of `a`
b = app.ServerManager.ChildWindow(parent = a.Parent().Parent().handle, title = "Add Role Services")

In this case parent handle that I'm passing will be overwritten with the app's handle.

To fix this just modify the following code:
# application.py:

line 560: ctrl_criteria["parent"] = dialog.handle

to

560: try:
561: ctrl_criteria["parent"]
562: except KeyError:
563: ctrl_criteria["parent"] = dialog.handle

This way, if the parent is passed, it will not be overwritten

Discussion


Log in to post a comment.