1

I am trying to interact with windows using pywinauto. Here's the code snippet I am using:

top_windows = Desktop().windows()
for w in top_windows:
    print(w.window_text())
    print(w.get_properties())
    w.draw_outline()

I successfully retrieve the window I need and use class_name from the properties I see in w.get_properties(). However, when I try to find the window using this class_name, I encounter a pywinauto.findbestmatch.MatchError.

NOTE: in propreties I have 'is_visible': False, 'is_enabled': True and 'automation_id': ''

Reference to the Pywinauto documentation Additionally, I am attempting to access properties like this:

Properties = Desktop().Common_Files_Properties
Properties.print_control_identifiers()

Can anyone help me understand why I am getting the MatchError and how to resolve it?

I tried using class_name from w.get_properties() to find a specific desktop window, expecting it to match and work without errors. However, I encountered a pywinauto.findbestmatch.MatchError

3
  • Please add the full error traceback with MatchError by editing your question. Such traceback contains line numbers which are very useful to find the problem. Also I don't see the failed piece of code which leads to MatchError. Commented Jan 24 at 16:36
  • 1
    @VasilyRyabov I fixed it by calling restore() to make it visible the window Commented Jan 24 at 16:49
  • 1
    Great! Please post it as an answer (it is OK to answer own questions) and mark it as accepted by gray check box to indicate the problem is resolved for others. Commented Jan 24 at 17:51

1 Answer 1

1

Using restore() to make the window visible fixes the problem.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.