Search code examples
pythonpywinauto

Pywinauto has gone nuts


Below is the image of code and error:

Code1

Below are the images of similar problem but using different line of code:

Code2

Code2

Code2

Code2

I have uploaded the images of the code_snippet. Sometimes Code1 works in the following line dlg.print_control_identifiers()

and many times it doesn't when I rerun the code.

I have uploaded 4 different images of Code2 in different scenario and error. I am frustrated very deeply. Can anybody guide me?

Possible errors

ElementAmbiguousError: There are 2 elements that match the criteria {'title_re': 'Miracle', 'top_level_only': False, 'backend': 'uia', 'process': 23860}

Solution

  • If you want to disambiguate your search (find only one element), please add more detailed criteria to child_window() keywords. Usually we recommend to combine title and control_type (using control_type also improves performance). If you give up finally, try to add found_index=0 keyword to child_window() criteria. It is applied after all other keywords are filtered in.