Search code examples
optimizationpython-3.7pywinauto

Optimising Pywinauto


I've got a script that uses PyWinAuto to do some UI automation, and it works, but actions like toggling checkboxes, locating a text box and one of my functions which uses print_control_identifiers are slow (or slower than a human doing the same thing).

From what I understand of how it works, this is due to recursive searches through the windows controls. I'm trying to limit the depth that I have to go to when calling print_control_identifiers, I think my main issue is the "best match" lookup that occurs when doing an action on an item. I'm currently trying to use the suggested IDs in an attempt to speed this up.

Any tips as to speeding up execution?


Solution

  • child_window(..., control_type="...") performs search faster because preliminary filtering by control_type doesn't require inter-process communication as well as class_name.

    best_match algorithm can be improved in general (I suspect it has N^3 complexity). This work is not started, I'd be happy to discuss any help.