LayoutLens Documentationยถ
LayoutLens is a production-ready AI-powered UI testing framework that enables natural language visual testing. It captures screenshots using Playwright and analyzes them with OpenAIโs GPT-4 Vision API to validate layouts, accessibility, responsive design, and visual consistency.
Key Achievement: 95.2% accuracy on professional ground truth benchmark suite.
๐ Quick Startยถ
pip install layoutlens
playwright install chromium
export OPENAI_API_KEY="your-key"
from layoutlens import LayoutLens
lens = LayoutLens()
result = lens.analyze("page.html", "Is the layout responsive?")
print(f"Answer: {result.answer}")
print(f"Confidence: {result.confidence:.1%}")
โจ Key Featuresยถ
Natural Language Testing: Ask questions like โIs the button properly aligned?โ
Multi-Viewport Support: Test across mobile, tablet, and desktop
Comprehensive Benchmarks: 31 test cases across 9 UI categories
95.2% Accuracy: Validated on professional ground truth suite
CI/CD Ready: GitHub Actions and Jenkins integration
๐ Documentationยถ
๐ Performance Metricsยถ
โ 95.2% accuracy on ground truth benchmark suite
โ 31 HTML test files across 9 specialized categories
โ ~23 seconds average processing time per test
โ Multi-viewport testing with responsive design validation
โ Production ready with professional documentation