A pragmatic Windows UI automation CLI built on top of pywinauto.
Project description
winauto-cli
winauto-cli is a Python CLI wrapper around pywinauto for Windows desktop automation, with an Agent-oriented command surface for inspection, interaction, validation, and screenshot capture.
Install
Install from PyPI:
pip install winauto-cli
Or, if you prefer explicit Python invocation:
python -m pip install winauto-cli
For local development:
pip install -e .
Agent commands
These commands default to JSON output and are intended to be composed by an AI Agent.
list-windows
List top-level windows:
winauto-cli list-windows
find
Return candidate matches instead of forcing a single element:
winauto-cli find --window-title "MyApp" --control-type Button --max-results 10
winauto-cli find --window-title "MyApp" --path "//Button[@name='Submit']"
winauto-cli find --window-title "MyApp" --path "Pane/Edit[0]"
inspect
Inspect one resolved element and return its children, parent chain, supported patterns, recommended selectors, and recommended paths:
winauto-cli inspect --window-title "MyApp" --name "Submit"
winauto-cli inspect --window-title "MyApp" --path "//Button[@name='Submit']"
inspect now returns path-oriented hints such as:
recommended_pathsrelative_path
These are intended for Agent follow-up calls using --path.
act
Run a single action against a resolved element:
winauto-cli act --window-title "MyApp" --name "Submit" --action click
winauto-cli act --window-title "MyApp" --control-type Edit --action type --text "hello"
winauto-cli act --window-title "MyApp" --path "//Button[@name='Submit']" --action click
assert
Validate existence, count, text, visibility, or enabled state:
winauto-cli assert --window-title "MyApp" --name "Submit" --assertion exists
winauto-cli assert --window-title "MyApp" --name "Submit" --assertion enabled --expected-bool true
winauto-cli assert --window-title "MyApp" --control-type Button --assertion count --expected 3
winauto-cli assert --window-title "MyApp" --path "//Button[@name='Submit']" --assertion exists
screenshot
Capture a screenshot for a resolved window or element:
winauto-cli screenshot --window-title "MyApp" --out app-window.png
winauto-cli screenshot --window-title "MyApp" --path "//Button[@name='Submit']" --out submit-button.png
winauto-cli screenshot --window-title "MyApp" --path "//Button[@name='Submit']" --highlight --out submit-button-marked.png
Useful highlight options:
--highlight--highlight-duration-ms 800--highlight-colour red--highlight-thickness 3
Path DSL
The --path query is XPath-like, but intentionally smaller and desktop-focused.
Supported forms:
//Button//Button[@name='Submit']//Edit[@auto_id='txtUsername']Pane/Edit[0]//Pane[@class_name='Toolbar']/Button[1]
Rules:
/means direct child step.//means descendant step.Typematchescontrol_type.[@name='x'],[@auto_id='x'],[@class_name='x'],[@control_type='x'],[@window_text='x']are supported.[0],[1], ... select by zero-based index after a step is filtered.
Compatibility commands
These are retained as convenience wrappers over the newer primitives.
dumpclicktype
Examples:
winauto-cli dump --window-title "MyApp"
winauto-cli click --window-title "MyApp" --name "Submit"
winauto-cli type --window-title "MyApp" --control-type Edit --text "hello from cli"
Selector model
Parent window options:
--window-title--window-title-re--window-class-name--window-auto-id
Target element options:
--name--auto-id--control-type--class-name--index--path
Runtime options:
--backend {uia,win32}--timeout <seconds>--top-level-only--verbose--json
Design intent
The project is optimized for AI-assisted test authoring and debugging:
findreturns candidate sets instead of hiding ambiguity.inspectexposes enough metadata to refine selectors.actseparates action execution from selector debugging.assertcloses the loop for script verification.screenshotprovides visual verification and failure evidence.--pathprovides a bridge between raw tree exploration and stable scripted lookup.- Compatibility commands remain available for quick manual use.
License
This project is licensed under the MIT License. See LICENSE.
Third-party dependencies keep their own licenses. See THIRD_PARTY_NOTICES.md.
Publishing
Build distributions:
python -m pip install build twine
python -m build
python -m twine check dist/*
Test on TestPyPI first:
python -m twine upload --repository testpypi dist/*
Then publish to PyPI:
python -m twine upload dist/*
Project details
Release history Release notifications | RSS feed
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 winauto_cli-0.1.1.tar.gz.
File metadata
- Download URL: winauto_cli-0.1.1.tar.gz
- Upload date:
- Size: 15.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e12e8953380200a8bbc9a5f4a04e06115990727d76ccfa948928be5d6f8c475f
|
|
| MD5 |
49c9ae7215ce43579bd5010bd8b2dc23
|
|
| BLAKE2b-256 |
f19fc43d38c0d8723f6b730ba40afd70a626bcac5e91f04f402d54ed25309095
|
File details
Details for the file winauto_cli-0.1.1-py3-none-any.whl.
File metadata
- Download URL: winauto_cli-0.1.1-py3-none-any.whl
- Upload date:
- Size: 14.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
470ae6c5be84defd3aec7a96fdb2a691fdaf00f02eb264890839f4fc3802c410
|
|
| MD5 |
1853c2174c32878c424bff781dca7cc1
|
|
| BLAKE2b-256 |
acd300c283983967a14136ccb5dc0c478cf29096be6f1a83e94058efeed2043d
|