AI for Playwright and Selenium
I’m excited to announce the release of coTestPilot.ai for Playwright and Selenium. An open-source extension for Playwright and Selenium from the test nerds at Checkie.AI that brings additional AI-powered testing capabilities to your automated testing. This project aims to democratize the value of AI-based testing by making it accessible to every automation engineer through a simple integration with their existing Playwright and Selenium tests.
What is coTestPilot?
coTestPilot is a lightweight version of the AI Testing Agents available at checkie.ai and testers.ai. It extends Playwright and Selenium with AI capabilities for automated testing and bug detection, leveraging GPT-4 Vision to analyze web pages for potential issues, inconsistencies, and usability problems.
The best part? Adding AI-powered checking to your existing test automation is as simple as adding a single function call.
Key Features
- Multiple Testing Personas: Ships with several built-in testing agent profiles, including UI/UX experts, accessibility specialists, security testers, and more
- Customizable Checks: Easy to add custom testing rules and specialized prompts
- Comprehensive Analysis: Identifies visual errors, content inconsistencies, and functionality issues
- Detailed Reporting: Generates HTML reports with screenshots and detailed issue descriptions
- Rate Limiting & Retry Logic: Built-in protection against API rate limits
Why Use AI Testing Agents?
Traditional automated tests are great at checking specific, predefined scenarios. However, they often miss unexpected issues that a human tester would catch immediately. coTestPilot bridges this gap by adding an AI-powered “extra set of eyes” to your automation suite.
The AI agents can identify issues like:
- Misaligned elements and visual bugs
- Content inconsistencies and typos
- Accessibility concerns
- Basic security issues
- Performance red flags
- UX problems
Getting Started
Installation is straightforward. The code is available at:
- Download the coTestPilot code folder, either for Sync or Async versions or Playwright, or Selenium, depending on the version you are using, and add it next to your existing code and import coTestPilot
from playwright.async_api import async_playwright
import playwright_async_cotestpilot # import ai checks
or, if using Playwright Sync:
from playwright.sync_api import sync_playwright
import playwright_sync_cotestpilot # import ai checks
2. Set your OpenAI API key:
export OPENAI_API_KEY=’your-api-key’
3. Wherever you think it is interesting to add more checks to your code, simply
# Your existing Playwright test
async with async_playwright() as p:
browser = await p.chromium.launch()
page = await browser.new_page()
await page.goto(‘https://example.com')
# Add AI checking with one line
result = await page.ai_check()
print(f”Found {len(result.bugs)} issues”)
For Selenium:
import selenium_cotestpilot
result = self.driver.ai_check()
Call for Contributors!
We’re actively seeking contributors to help port the opensource coTestPilot to other languages, particularly:
- JAVA, JavaScript, C#
- Appium, Cypress, others?
And.. add PIP and other installers to make it even easier for folks to add AI to their code!
This is a perfect opportunity to contribute to the testing automation community while gaining experience with AI integration. The core functionality is language-agnostic, making it an ideal project for learning about AI-powered testing.
Community Focus
Any issues found by the AI are written out to a json file at a location you can specifiy. From there it can be imported into JIRA, etc. There is also a quick reporting UX build it in too, ust call the report function, and a quick HTML reporting dashboard for the AI checks is generated to make it easy to take credit for all the issues the AI found :)
To generate a report, jsut call this new function added to the Playwright page object or the Selenium driver:
report_gen = await self.page.ai_report()
Community Focus
This project is for the community, by the community. While professional versions with enhanced features are available through checkie.ai and testers.ai, this open-source version ensures that every automation engineer has access to basic AI-powered testing capabilities.
The goal is simple: help automation engineers add more comprehensive checking to their test suites with minimal effort. Whether you’re running a small test suite or managing enterprise-level automation, coTestPilot can help catch issues that traditional automated tests might miss.
What’s Next?
The roadmap includes:
- Support for more languages
- Additional testing personas
- Enhanced reporting capabilities
- PIP install support
Contributing
Be nerd famous and contribute to adding AI to the most popular frameworks (probably looks good on a resume!). If you’re interested in contributing, particularly in porting to JavaScript, JAVA, or C#, please check out the GitHub repository.
Remember, this is more than just a tool — it’s an opportunity to shape the future of test automation. Join us in making AI-powered testing accessible to everyone!
Please signup to contribute and port to other platforms and languages!
Would be great if folks could also help add support for Anthropic, Azure, etc, and local LLMs like Ollama so folks can run behind their firewall and without an API Key.
Get Started Today
Check out our GitHub repository to start enhancing your tests with AI capabilities. Whether you’re adding basic checks to your existing suite or building comprehensive AI-powered testing scenarios, coTestPilot is here to help.
Together, we can make test automation smarter, more efficient, and more accessible to everyone in the testing and automation community.
— -
To learn more or contribute to the project, visit our GitHub repository or reach out to us on our community channels. Let’s work together to make testing better for everyone!