AI-driven cross-platform UI automation engine with test script generation
Project description
ScreenForge
中文 | English
Your AI agent runs the test. You keep the pytest file.
Describe the flow in plain language. Watch the agent click through a live site. Walk away with a self-healing pytest script that survives UI changes — and runs in CI. (Drives real iOS + Android devices too, not just Chrome.)
ScreenForge is an AI-driven UI automation engine that turns natural language into executable test scripts. Unlike record-and-replay tools, you don't perform the actions yourself — the AI does it for you.
Why ScreenForge?
| Playwright Codegen | Browser Use | Midscene.js | ScreenForge | |
|---|---|---|---|---|
| Need to perform actions yourself? | Yes | No | No | No |
| Generates replayable test scripts? | Yes | No | No | Yes (pytest) |
| Self-healing when UI changes? | No | No | No | Yes |
| Works as AI Agent tool (MCP)? | No | Yes | No | Yes |
| Drives real iOS / Android devices? | No | No | No | Yes |
Core architecture: Your AI Agent is the brain (understands requirements, makes decisions). ScreenForge is the hands (executes UI actions, generates code).
Quick Start
pip install screenforge
# See the magic without any API key:
screenforge --demo
# For real usage, set your LLM key:
export OPENAI_API_KEY=sk-...
# Inspect the current page (returns DOM tree for your Agent to analyze):
echo '{"operation":"inspect_ui","platform":"web"}' | screenforge --tool-stdin
# Execute a single action:
screenforge --action click --platform web --locator-type text --locator-value "Login"
How It Works
You (or your AI Agent) ScreenForge
│ │
├──── "Test the login" ─────►│
│ ├── inspect_ui (get DOM tree)
│◄── DOM tree ──────────────┤
│ │
├──── click #email ─────────►│
├──── input "user@..." ─────►│
├──── click "Sign In" ──────►│
│ │
│◄── pytest script ─────────┤
│◄── Allure report ─────────┤
Each step: inspect → decide → act → verify. The AI decides, ScreenForge executes.
Features
- Keep a real pytest file: Every run emits a replayable
pytestscript (Allure-instrumented) you can drop straight into CI — not a black-box agent run. - Self-healing engine: When the UI changes and a locator breaks, the engine auto-repairs it with confidence scoring and AST validation, so your committed test survives.
- The agent does the clicking: You (or your AI agent) describe intent; ScreenForge inspects the DOM, acts, and verifies — you never record by hand.
- Real devices, not just browsers: Drives Android (uiautomator2) and iOS (wda) physical devices over the same protocol — the one thing pure-web agents (Playwright MCP, Browser Use) can't do.
- L1/L2 semantic cache: Same page + same instruction = instant response, no LLM call needed
- Visual fallback: When DOM can't locate elements (Canvas, games), VLM parses screenshots
- MCP server: Any MCP-compatible Agent can drive ScreenForge natively
- Structured output: JSON Lines events +
report/runs/<id>/artifacts for CI integration - Live Mirror playground: Watch the generated pytest code grow line-by-line beside a live screenshot as the test runs —
screenforge --playground. See the Playground Guide
Agent Integration (Claude Code / Cursor / Codex)
ScreenForge exposes itself as a tool for AI Agents. The standard loop:
# 1. Get page structure (your Agent analyzes it)
echo '{"operation":"inspect_ui","platform":"web"}' | screenforge --tool-stdin
# 2. Your Agent decides what to do, sends precise actions
screenforge --action click --platform web --locator-type text --locator-value "Login"
# 3. Verify the result, repeat
echo '{"operation":"inspect_ui","platform":"web"}' | screenforge --tool-stdin
For batch operations, use workflows:
screenforge --workflow ./workflows/login.yaml --platform web --json
Or start the MCP server for native Agent integration:
screenforge --mcp-server
GitHub Actions
Add ScreenForge to your CI pipeline:
- uses: jhinzzz/ScreenForge@v1
with:
platform: web
workflow: ./workflows/login.yaml
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
Results are auto-uploaded as Allure artifacts. See action.yml for all inputs.
See Agent Integration Guide for the complete protocol.
Installation (from source)
git clone https://github.com/jhinzzz/ScreenForge.git
cd ScreenForge
python -m venv .venv && source .venv/bin/activate
pip install -e ".[all]"
Platform-specific extras:
- Web only:
pip install -e .(default, includes Playwright) - Android:
pip install -e ".[android]" - iOS:
pip install -e ".[ios]" - ML/cache:
pip install -e ".[ml]"(sentence-transformers for semantic cache)
Configuration
# Required: LLM API key (OpenAI-compatible endpoint)
export OPENAI_API_KEY=sk-...
# Optional: custom endpoint (defaults to api.openai.com)
export OPENAI_BASE_URL=https://api.openai.com/v1
# Optional: model (defaults to gpt-4o)
export MODEL_NAME=gpt-4o
Or create a .env file (copy from .env_template).
Badge
If ScreenForge generates tests for your project, add this badge to your README:
[](https://github.com/jhinzzz/ScreenForge)
Learn More
| Resource | Description |
|---|---|
| Mobile Setup | Android & iOS device connection guide |
| MCP Setup (3 min) | Connect to Claude Desktop / Cursor / Cline / Claude Code |
| Agent Guide | Integration protocol for AI Agents |
| Capability Matrix | Supported platforms, actions, and locators |
| Architecture Deep-Dive | Brain/hands split, semantic cache, self-heal AST gates, hygiene-as-feature |
| Examples | Real committed workflows + the green pytest they generated |
| Playground Guide | Live Mirror — watch code + screenshots grow as the test runs |
| Workflow Examples | YAML workflow templates |
| CHANGELOG | Version history |
Contributing
See CONTRIBUTING.md for guidelines. Issues and PRs welcome!
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 screenforge-0.6.1.tar.gz.
File metadata
- Download URL: screenforge-0.6.1.tar.gz
- Upload date:
- Size: 212.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ea43cfe9d8ae5d3339aec0e4d2795e275511585cb264df9ba4ce53ea7831c80
|
|
| MD5 |
369b66faecd22b233be4a7b8fc8f13a4
|
|
| BLAKE2b-256 |
f08764977c2e4930f66f8ba612c69d0b0e66b8e67e0853efbaa113e1e67be610
|
Provenance
The following attestation bundles were made for screenforge-0.6.1.tar.gz:
Publisher:
release.yml on jhinzzz/ScreenForge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
screenforge-0.6.1.tar.gz -
Subject digest:
8ea43cfe9d8ae5d3339aec0e4d2795e275511585cb264df9ba4ce53ea7831c80 - Sigstore transparency entry: 1802301804
- Sigstore integration time:
-
Permalink:
jhinzzz/ScreenForge@a4da55659ec8ea2e443ab1ac56f60260931849df -
Branch / Tag:
refs/tags/v0.6.1 - Owner: https://github.com/jhinzzz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a4da55659ec8ea2e443ab1ac56f60260931849df -
Trigger Event:
push
-
Statement type:
File details
Details for the file screenforge-0.6.1-py3-none-any.whl.
File metadata
- Download URL: screenforge-0.6.1-py3-none-any.whl
- Upload date:
- Size: 146.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d23ada3bae6564b923cc2a52b948523f9fca08f79965ff7aef59b4a39e31860
|
|
| MD5 |
56fceb43db75b5032d2299145ebb0472
|
|
| BLAKE2b-256 |
54f188c400e0fd4aa4a4916661275804bea25468315feb48a398ce657762056f
|
Provenance
The following attestation bundles were made for screenforge-0.6.1-py3-none-any.whl:
Publisher:
release.yml on jhinzzz/ScreenForge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
screenforge-0.6.1-py3-none-any.whl -
Subject digest:
5d23ada3bae6564b923cc2a52b948523f9fca08f79965ff7aef59b4a39e31860 - Sigstore transparency entry: 1802301840
- Sigstore integration time:
-
Permalink:
jhinzzz/ScreenForge@a4da55659ec8ea2e443ab1ac56f60260931849df -
Branch / Tag:
refs/tags/v0.6.1 - Owner: https://github.com/jhinzzz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a4da55659ec8ea2e443ab1ac56f60260931849df -
Trigger Event:
push
-
Statement type: