Playwright C# Agentic Framework
A production-ready C# test automation framework that combines Playwright's powerful browser automation with intelligent healing agents. Write maintainable tests using SpecFlow (Gherkin), leverage Page Object Model patterns, and let AI agents automatically repair broken selectors when your application changes.
View on GitHubOverview
The Playwright C# Agentic Framework is designed for teams that need reliable, self-healing test automation. It integrates:
- Playwright – Fast, reliable browser automation
- SpecFlow – Readable Gherkin scenarios with NUnit runner
- Page Object Model (POM) – Maintainable selector management
- Healing Agents – Automatic selector repair when tests break
Key Features
🎭 Planner Agent
Explores your application and produces a comprehensive Markdown test plan. Use it to generate structured test strategies before writing scenarios.
🎭 Generator Agent
Transforms test plans into executable SpecFlow feature files and step definitions. Accelerate test creation with AI-generated scenarios.
🎭 Healer Agent
The core innovation: automatically detects selector failures and repairs Page Objects without manual intervention. When your application's DOM changes, the Healer updates your tests automatically.
How Healing Works
The framework uses a three-phase approach to maintain test reliability:
- Learn Phase: During green test runs, the framework records multiple locator strategies per element (data-test attributes, role+name combinations, CSS selectors) into a registry.
- Failure Detection: When a selector breaks, the Healer parses failing pages from test output to identify the exact failure point.
- Auto-Repair: Using the selector registry and Roslyn code analysis, the Healer rewrites failing Page Object properties to use known-good strategies, rebuilds the project, and re-runs tests.
Quick Start
Project Structure
Framework/ # Core test framework (POM, config, selectors)
Agents/ # Planner / Generator / Healer console app
Tests.E2E/ # SpecFlow features, steps, hooks, appsettings, NUnit
agents/ # Output folder for plans and selectors.registry.json
artifacts/ # (optional) traces/videos on failures
Requirements
- .NET SDK 9.0+
- Playwright browsers (installed per project)
- Allure CLI (for reporting) –
brew install allureon macOS
Next Steps
- Getting Started – Set up your first test
- Healing Engine – Understand how auto-repair works
- Running Tests – Execute and parallelise your suite
- Reporting – Generate Allure reports
- CI/CD – Integrate with your pipeline
Why This Framework?
Traditional test automation requires constant maintenance when applications change. Selectors break, tests fail, and developers spend hours updating Page Objects. The Playwright C# Agentic Framework eliminates this burden by:
- Recording multiple selector strategies during successful runs
- Automatically detecting when selectors fail
- Self-repairing Page Objects using known-good alternatives
- Rebuilding and re-running tests without manual intervention
Focus on writing test scenarios, not fixing broken selectors.