AI-powered Selenium test automation framework with MCP integration
pip install selenium-autopilot Copy PIP instructions
Selenium Autopilot is a Python command-line tool and Selenium helper library for browser-test automation. It can turn written requirements into a structured test plan, generate a pytest/Selenium project from a reviewed plan, and analyze test failures to suggest locator repairs. Generated tests and repair suggestions require human review; the tool does not change your application or automatically apply fixes.
You do not need to clone or download this repository to use the package.
Install Selenium Autopilot in the Python environment where you want to use it:
python -m pip install selenium-autopilot This installs the autopilot command and the Python dependencies. Check that it is available with:
autopilot --help Configure an AI provider Planning, test generation, and locator proposals use an OpenAI-compatible chat-completions API. By default, the tool uses the OpenAI API URL and the gpt-4o-mini model. Set your API key as an environment variable before running those commands.
$env:AUTOPILOT_LLM_API_KEY = "your-api-key" macOS or Linux:
export AUTOPILOT_LLM_API_KEY="your-api-key" You can also configure a different endpoint and model with AUTOPILOT_LLM_BASE_URL and AUTOPILOT_LLM_MODEL. For example, a local OpenAI-compatible service might use:
AUTOPILOT_LLM_BASE_URL=http://localhost:11434/v1 AUTOPILOT_LLM_MODEL=your-local-model Local HTTP is supported only for loopback addresses; remote providers must use HTTPS. Never put API keys, passwords, or other secrets in requirements, source files, or generated tests. Requirements and any source files you pass to plan are sent to the configured provider, so only share content you are permitted to share.
Create a Markdown file describing what users should be able to do and what the application should show. Be specific about preconditions, actions, and expected results. Use an approved test environment and synthetic test data.
# Sign-in requirements - Given a valid test account, submitting its credentials signs the user in. - After successful sign-in, the dashboard is displayed. - Invalid credentials do not sign the user in. - The application displays an error when sign-in is rejected. If a behavior or expected message is not defined, say so. The planner records ambiguities rather than deciding what your application should do.
autopilot plan --requirements requirements.md --output artifacts/test-plan.json The plan contains a summary, prioritized scenarios, preconditions, steps, expected results, ambiguities, and risks. You can provide relevant source files as additional context; repeat --source for each file:
autopilot generate --plan artifacts/test-plan.json --output generated_tests The output includes a tests folder, Page Objects, a Chrome WebDriver fixture, and project setup files. Generated URLs, locators, test data, and assertions may need changes for your application. Review every generated file before running it; generation does not guarantee correct tests.
Install the generated project's dependencies and run its tests:
cd generated_tests python -m pip install pytest selenium python -m pytest Use a non-production environment and approved test accounts. The generated fixture runs Chrome in headless mode. If the output already contains generated files, Autopilot refuses to replace them unless you pass --overwrite; review the existing files first.
To save browser diagnostics and a failure report when a test fails, run pytest with the Autopilot plugin enabled:
python -m pytest -p autopilot.pytest_plugin --junitxml=junit.xml For failures that have a driver fixture, the plugin saves a screenshot, DOM snapshot, browser metadata, and failure-report.json under artifacts/diagnostics/ by default. You can change that location with AUTOPILOT_ARTIFACTS_DIR.
autopilot analyze --report artifacts/diagnostics/path-to-failure/failure-report.json --output artifacts/failure-analysis.json For a locator-drift failure, request a proposed locator change:
autopilot heal --report artifacts/diagnostics/path-to-failure/failure-report.json --source tests/test_login.py --output artifacts/healing-proposal.json The failure report must include the current locator_strategy and locator_value (for example, "css" and "#submit"). Add these fields to the report if they were not captured. The source file must contain the old locator as a single string value.
Healing creates a JSON proposal and diff; it does not edit the source file, change assertions, or rerun tests. The command-line workflow does not check the proposed locator against a live browser, so its uniqueness is reported as unchecked. Review the evidence and diff, verify the locator yourself, and apply an accepted change manually before rerunning the affected test and relevant regressions. Locator healing is not intended to fix application defects, invalid test data, or environment problems.
Run autopilot --help or autopilot --help for all available options. Output files are not overwritten by default; use --overwrite only after reviewing existing outputs.
All 2 files in this release have provenance metadata.
AI MCP browser-automation pytest selenium test-automation test-generation
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.
All 2 files in this release have been uploaded with provenance metadata.
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.




