Pywinauto: Extracting child controls

45 Views Asked by At

I want to extract all the child controls of all the visible controls on notepad and create a map of it.

For instance, I want to extract all the controls of File control i.e., New, New Window, Open, Save...,etc.

I want to also do it recursively for all the child controls as well.

Here is my code:

    from pywinauto.application import Application
    import pygetwindow as gw
    from pywinauto import Desktop

# Get the active window

    active_window = gw.getActiveWindow()

# Get the title of the active window

    active_window_title = active_window.title

# Connect to the active window using the title

    app =Application(backend="uia").connect(title=active_window_title, visible_only=False)
    active_window = app.top_window()
    controls = active_window.print_control_identifiers()
    visible_controls = active_window.descendants()
0

There are 0 best solutions below