LayoutLens Documentationยถ

PyPI Version Python 3.11+ 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

Indices and tablesยถ