I'm trying run LibreOffice calc with pywinauto:
from subprocess import Popen
from pywinauto import Desktop
from pywinauto.application import Application
p = Popen('scalc.exe', shell=True)
print("PID: {}".format(p.pid))
calc = Desktop(backend="win32").Untitled1LibreOfficeCalc
calc.wait('visible')
calc.print_control_identifiers()
As result application starts and I get next output:
PID: 3740
Control Identifiers:
SALFRAME - 'Untitled 1 — LibreOffice Calc' (L0, T0, R960, B669)
['Untitled 1 — LibreOffice Calc', 'Untitled 1 — LibreOffice CalcSALFRAME', 'SALFRAME']
child_window(title="Untitled 1 — LibreOffice Calc", class_name="SALFRAME")
So pywinauto can't see any other elements under the main window.
So the question, have I missed something? What I do wrong?
I've tried to use "uia" backend, but in that case I'm getting error like this:
PID: 7412
Control Identifiers:
Traceback (most recent call last):
File "test.py", line 23, in <module>
calc.print_control_identifiers()
File "c:\DEV\venv-test\lib\site-packages\pywinauto\application.py", line 689, in print_control_identifiers
print_identifiers([this_ctrl, ])
File "c:\DEV\venv-test\lib\site-packages\pywinauto\application.py", line 653, in print_identifiers
rect=ctrl.rectangle())
File "c:\DEV\venv-test\lib\site-packages\pywinauto\base_wrapper.py", line 367, in rectangle
return self.element_info.rectangle
File "c:\DEV\venv-test\lib\site-packages\pywinauto\uia_element_info.py", line 326, in rectangle
bound_rect = self._element.CurrentBoundingRectangle
_ctypes.COMError: (-2147220991, 'An event was unable to invoke any of the subscribers', (None, None, None, 0, None))
In addition, application has stoped to react on mouse or keyboard and windows showed "close/wait" dialog. But in 5 minutes it come back. I've tried Spy++, Inspect, "AutoIt Windows Info" and py_inspect. All of them show me scalc window with title = "Untitled 1 — LibreOffice Calc" and nothig more.