Client library for macOS accessibility
Project description
pyax
Client library for macOS accessibility
The library provides convenient entry points for retreiving accessible objects, and setting up notification observers.
This library also Pythonifies AXUIElement and AXObserver and provides easy ways to access attributes, query the accessible element's heirarchy.
Installation
$ pip install pyax[highlight]
Usage
Command Line
Inspecting an element
The inspect command allows you to select an element under the pointer for inspection, and print out any interesting information about the object. This command requires the highlight extra.
Examining the accessible tree
The tree command allows you to dump the current tree of an application, web app or specific subtree. You can choose which attributes to show, or show all available attributes. You can list actions, and you can output the tree in a JSON format.
% pyax tree Safari -w -a AXTitle -a AXValue -a AXSubrole
AXWebArea AXTitle='' AXValue='' AXSubrole=None
AXGroup AXTitle='' AXValue='' AXSubrole=None
AXStaticText AXTitle='' AXValue='Name:' AXSubrole=None
AXStaticText AXTitle='' AXValue='Name:' AXSubrole=None
AXTextField AXTitle='Name:' AXValue='John' AXSubrole=None
AXGroup AXTitle='' AXValue='' AXSubrole='AXEmptyGroup'
AXGroup AXTitle='' AXValue='' AXSubrole=None
AXStaticText AXTitle='' AXValue='Email:' AXSubrole=None
AXStaticText AXTitle='' AXValue='Email:' AXSubrole=None
AXTextField AXTitle='Email:' AXValue='john@example.com' AXSubrole=None
AXGroup AXTitle='' AXValue='' AXSubrole='AXEmptyGroup'
AXGroup AXTitle='' AXValue='' AXSubrole=None
AXStaticText AXTitle='' AXValue='Message:' AXSubrole=None
AXStaticText AXTitle='' AXValue='Message:' AXSubrole=None
AXTextArea AXTitle='Message:' AXValue='hi its me' AXSubrole=None
AXGroup AXTitle='' AXValue='' AXSubrole=None
AXStaticText AXTitle='' AXValue='hi its me' AXSubrole=None
Observing accessible notifications
The Observe command allows you to observe any give accessibility notification an app may emit, and the associated data with that notification.
% pyax observe Safari
AXFocusedUIElementChanged AXTextArea AXTitle='Message:' AXValue='hi its me'
AXSelectedTextChanged AXTextArea AXTitle='Message:' AXValue='hi its me. '
API
See examples directory for in-depth use.
Here is what a basic interactive session could look like:
>>> import pyax
>>> app = pyax.get_application_by_name('Safari')
>>> print(app)
[AXApplication | Safari]
>>> web_root = app.search_for(lambda e: e["AXRole"] == "AXWebArea")
>>> print(web_root)
[AXWebArea | ]
>>> for child in web_root:
... print(child, child["AXDOMIdentifier"])
[AXGroup | ] content
[AXHeading | Navigation menu]
[AXGroup | ] p-personal
[AXGroup | ] p-namespaces
[AXGroup | ] p-views
[AXGroup | ] p-search
[AXGroup | ] p-logo
[AXGroup | ] p-navigation
[AXGroup | ] p-interaction
[AXGroup | ] p-tb
[AXGroup | ] p-coll-print_export
[AXGroup | ] p-wikibase-otherprojects
[AXGroup | ] p-lang
[AXGroup | ] footer
License
pyax was created by Eitan Isaacson. It is licensed under the terms of the MIT license.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyax-0.3.3.tar.gz.
File metadata
- Download URL: pyax-0.3.3.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b86080cb1d32fd8fdeddffe817af4fe9bcefe276527371e685acd68a4e0b6205
|
|
| MD5 |
2122889a7d72cb657dfeed7e00e18ebd
|
|
| BLAKE2b-256 |
ac78bf909c3e73c189684f57cb375129c1dfdcb74bc62650fa6ec9feaea47d51
|
Provenance
The following attestation bundles were made for pyax-0.3.3.tar.gz:
Publisher:
workflow.yml on eeejay/pyax
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyax-0.3.3.tar.gz -
Subject digest:
b86080cb1d32fd8fdeddffe817af4fe9bcefe276527371e685acd68a4e0b6205 - Sigstore transparency entry: 633862984
- Sigstore integration time:
-
Permalink:
eeejay/pyax@74b5ae275e30b1bbd3d844dba9c92eb87ecb2ed9 -
Branch / Tag:
refs/tags/V_0_3_3 - Owner: https://github.com/eeejay
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@74b5ae275e30b1bbd3d844dba9c92eb87ecb2ed9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyax-0.3.3-py3-none-any.whl.
File metadata
- Download URL: pyax-0.3.3-py3-none-any.whl
- Upload date:
- Size: 20.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1bbd88e93e6a729fc4ce2f40feaa7f59ae0a8c8858295e88158ddbe6ede462f
|
|
| MD5 |
ea465a6045a7a479037306802763d19b
|
|
| BLAKE2b-256 |
91ec4e5598b09ebc99cea2bcf71b0b7622da2d02afd062d6defd92054dc86ab6
|
Provenance
The following attestation bundles were made for pyax-0.3.3-py3-none-any.whl:
Publisher:
workflow.yml on eeejay/pyax
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyax-0.3.3-py3-none-any.whl -
Subject digest:
d1bbd88e93e6a729fc4ce2f40feaa7f59ae0a8c8858295e88158ddbe6ede462f - Sigstore transparency entry: 633863019
- Sigstore integration time:
-
Permalink:
eeejay/pyax@74b5ae275e30b1bbd3d844dba9c92eb87ecb2ed9 -
Branch / Tag:
refs/tags/V_0_3_3 - Owner: https://github.com/eeejay
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@74b5ae275e30b1bbd3d844dba9c92eb87ecb2ed9 -
Trigger Event:
push
-
Statement type: