COM communication very slow (comtypes and MSAA problem!)
I am trying to write a tool to automatically install a binary. Basically, I use comtypes and MSAA interface to interact with the installation windows and drive the installation procedure. When a window pops up, I recursively enumerate all elements on this window, pick the most appropriate element (typically a button) to interact, and so on. The tool sometimes works fine. But sometimes, it may take very long time in enumerating the elements (could be up to 1.5 mins for a window that is not very complex). And this problem seems to be timing related. It doesn't happy all the time. I have stuck on this problem for a week. Can someone help? Please!!!
One possibility I can think of is: while I am enumerating a window, this window is destroyed by the target application, then COM is mssed up and fails to do further navigation. Could it be a poten开发者_运维问答tial reason? I can't convince myself on this because the window is finally enumerated. If the window disappears during the enumeration, the traversal of the window element tree should fail, no?
Try profiling the script until the issue occurs, then look through the profiling information to find out where the extra time is being spent.
精彩评论