Add ax_props: read rich UIA element properties before acting#416
Merged
Conversation
The flat element list carries only name/role/bounds/app/id, but automation needs more before it acts: is the control enabled (don't click a disabled button), is it off-screen, its item_status, help_text (tooltip), accelerator_key. get_element_properties reads those UIA properties; is_element_enabled is the common pre-action guard. Extends the backend ABC + Windows UIA backend via the same fake-backend seam.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 26 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Why
list_accessibility_elements/AccessibilityElementcarry only name / role / bounds / app / pid / automation_id. Automation routinely needs more before it acts: is the control enabled (don't click a disabled button), is it off-screen, its item_status (field validation/error text), help_text (tooltip), and accelerator_key (drive via hotkey instead of click).ax_propsexposes those high-value UIA properties.get_element_properties—{enabled, offscreen, help_text, item_status, accelerator_key, access_key, orientation}is_element_enabled— the common pre-action guardSecond feature of the ROUND-15 native-UIA depth lane (the highest-frequency property reads, per the research).
Design
base.py_unsupporteddefault) + real reads inwindows_backend.py(a_PROPERTY_READStable overCurrentIsEnabled/CurrentIsOffscreen/CurrentHelpText/CurrentItemStatus/CurrentAcceleratorKey/CurrentAccessKey/CurrentOrientation, each guarded) + autils/ax_props/facade dispatchingget_backend()— the same fake-backend seam ascontrol_patterns/ax_text/virtualized.__all__→AC_get_element_properties→ read-onlyac_get_element_propertiesMCP tool → Script Builder (Native UI). Qt-free verified.Tests
test/unit_test/headless/test_ax_props_batch.py— fake backend covers the property dispatch, not-found → None,is_element_enabledtrue/false/None, the unsupported-backend error, the executor{found, properties}wrapper, and 5-layer wiring. 8 passed (15 with the virtualized sibling). Real UIA not run in CI, matching the accessibility lane.