Search code examples
pythonpywinauto

Is there a way to speed up pywinauto?


Here is a snippet of my code:

...
my_program = os.path.join(this_dir, 'my_program.exe')

app = Application(backend="uia").start("\"{}\" \"{}\"".format(my_program, arg))

app_explicit = app['My Program Window Name - {}'.format(os.path.basename(arg))]

#app.Dialog.TabControl.Summary.print_control_identifiers()

start = time.time()
app_explicit.TabControl.Summary.select()  ### Slow Command 1
print(time.time() - start)

start = time.time()
export_list = app_explicit.TabControl.ListBox.texts() ### Slow Command 2
print(time.time() - start)

...

For some reason the slow command 1 takes 4 seconds to run and slow command 2 takes 43 seconds. Is there any particular reason for that ? Is there any way that these two commands, specially the second one, to be computed faster ? (The Listbox object is not large. It contains roughly 40-50 static texts)

Thank you.


Solution

  • There are known performance issues we're trying to address partially in next major release.

    This issue should tell you a lot about possible optimizations and reasons for them:

    This is more about current work and plans: