Was surprised to learn that there are apparently no command line tools for poking around the Linux accessibility tree, so I made Acsh, the Accessibility Shell. With Acsh you have both a CLI and REPL, in which you can do things like:
/> ls # Lists all top-level apps
/> cd firefox-1.26 # cd into Firefox, with tab completion. REPL only
/firefox-1.26> cat 0 # Get more information on the first child by index, if you're fine with the possibility that index might change before the command is processed--not likely at this level. Paths are referenced by name or index
/firefox-1.26> watch 0 # Get stream of events for the first child
/firefox-1.26> search -r button ok # Find all OK buttons in this Firefox instance
... # and more
The future, though, is probably acsh mount. This makes the accessibility tree available as a FUSE mount under ./a11y by default. ./a11y/README.md gives a better overview of the layout, but in brief, directories are apps/accessible objects with their children as subdirectories. Properties are either files containing their raw values or .json files with richer structure. There's an events.json.sock Unix socket in each directory below the root that lets you watch events for an accessible object and all its children, and you can use standard filesystem tooling to search/filter/stream. It's probably slow because there's no caching--it's meant to be a debugging/introspection tool, after all. I'll probably rename this to acfs and drop the CLI/REPL soon--it was great for prototyping and the idea to use FUSE only occurred to me after I realized I was slowly re-inventing all of a filesystem anyway.
Thoughts? I'm sure it has bugs, but what doesn't? https://dev.thewordnerd.info/nolan/acsh