got a pane element instead of window when using pywinauto

1.4k Views Asked by At

so i have this code which is supposed to connect to discord app.

import pywinauto
import pywinauto.mouse as mouse
import pywinauto.keyboard as keyboard
from pywinauto.application import Application
import warnings
warnings.simplefilter('ignore', category=UserWarning)
app = Application(backend='uia').connect(path=r"C:\Users\Owner\AppData\Local\Discord\app-0.0.307\Discord.exe")
dlg = app.window(title='Discord')

I was confused why the code isn't working, turns out i think it's because discord isn't recognized as a window, but it is recognized as a pane as you can see here in my screenshot: screenshot

2

There are 2 best solutions below

1
On BEST ANSWER

That's because pywinauto won't support the automation process if it's not recognized as the window, i.e pane object.

1
On

Compare app.process and check what the app.windows return.