auto-playwright  by lucgagan

Playwright extension for AI-driven browser automation

created 1 year ago
774 stars

Top 46.0% on sourcepulse

GitHubView on GitHub
Project Summary

This library enables the automation of Playwright browser tests using natural language prompts processed by OpenAI's GPT models. It's designed for developers and QA engineers looking to accelerate test creation and handle complex scenarios without writing explicit selectors, offering a potentially faster implementation and a TDD-friendly approach.

How It Works

The auto function takes a natural language prompt and uses the provided Playwright page object to interact with web elements. It infers whether to perform an action (like clicking or typing), query data, or make an assertion based on the prompt's intent. The core advantage lies in its ability to abstract away the need for CSS selectors or XPath, allowing AI to interpret the page structure and user intent, thereby simplifying test writing and maintenance.

Quick Start & Requirements

  • Install: npm install auto-playwright -D
  • Prerequisites: Node.js, OpenAI API key (exported as OPENAI_API_KEY or in a .env file). Azure OpenAI is also supported with specific configuration.
  • Usage: Import auto and use it with prompts, passing Playwright's page and test objects. See official examples.

Highlighted Details

  • Supports both standard OpenAI and Azure OpenAI endpoints.
  • Can execute actions (e.g., click, fill), queries (data retrieval), and assertions (boolean outcomes).
  • Leverages HTML sanitization to reduce payload size sent to OpenAI, aiming for cost efficiency.
  • Debugging can be enabled via debug: true option or AUTO_PLAYWRIGHT_DEBUG=true environment variable.

Maintenance & Community

  • The project is open-source, with no specific mention of core maintainers or community channels like Discord/Slack in the README.
  • It draws inspiration from ZeroStep, aiming to provide an open-source alternative.

Licensing & Compatibility

  • Licensed under the MIT License, permitting commercial use and modification.
  • Compatible with any browser supported by Playwright.

Limitations & Caveats

The project is positioned as an exploration of the underlying technology of ZeroStep and suggests ZeroStep for production environments due to its more robust implementation. Auto Playwright does not use screenshots, queues, WebSockets, implement parallelism, or allow scrolling, features present in ZeroStep.

Health Check
Last commit

3 weeks ago

Responsiveness

1 day

Pull Requests (30d)
1
Issues (30d)
1
Star History
79 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.