I can't access all the elements of the application using pyatspi
I understand the automation of application testing on linux (specifically using Ubuntu 20). I need to access all the elements of the installer application (just an application with a GUI to automate the installation of some utilities). My code:
import pyatspi
def print_accessible(accessible, padding=""):
if accessible is not None:
role = accessible.getRoleName()
name = accessible.name if accessible.name else "Without a name"
print(padding + role, name)
for child in accessible:
print_accessible(child, padding + " ")
desktop = pyatspi.Registry.getDesktop(0)
installer_app = None
for app in desktop:
if app.name == "installer":
installer_app = app
break
if installer_app is not None:
print_accessible(installer_app)
else:
print("installer not found.")
In this case, I only get the output:
application installer
frame installer
At the same time, if I use the Accerciser utility and click on the specified application inside Accerciser, then after executing my code, the output will already be like this:
application installer
frame installer
panel Without a name
panel Without a name
panel Without a name
panel Without a name
panel Without a name
panel Without a name
panel Without a name
document web installer
section Without a name
section Without a name
push button Automatic installation/update
push button Installation/update with settings
In the first case, the first element "panel Without a name" is defined by me as None and I can no longer access its child subelement, but after activating the installer in the Accerciser program, I get all the elements for output.
The question is, how can I get all the window elements without using Accerciser? Or maybe I can "activate" the window through Accerciser using the console command and then get a list of all the elements
I also tried to use it at the beginning of my code
wmctrl -a "installer"
But such activation of the window did not lead to anything.