An AI-powered skill that automatically generates Playwright test scripts from natural language descriptions, HTML/page analysis, or existing page URLs.
This skill activates when the user:
Provide test steps in plain English and get complete test scripts.
Example:
text
Input: "Login to the app with username and password, then verify dashboard loads"
Output: Complete pytest-playwright test with POM
Provide a URL or HTML content to extract elements and generate Page Object Model.
Example:
text
Input: URL https://example.com/login
Output: login_page.py with all form element locators + methods
Provide HTML snippets to extract robust CSS/XPath selectors.
GenreDescriptionFrameworkpomPage Object Modelpytest-playwright / Jest PlaywrightstandardStandard test scriptpytest-playwright / native Playwrightdata-drivenParameterized data testspytest-playwright / Jest PlaywrightapiAPI test helpersAny
FrameworkLanguageCode Typepytest-playwrightPythonpom, standard, data-drivenjest-playwrightJavaScript/TypeScriptpom, standard, data-drivennative-playwrightJavaScript/TypeScriptstandard, pom
bash
# Generate from natural language
playwright-test-generator generate \
--input "Click login button, enter username and password, click submit" \
--framework pytest \
--type pom \
--output ./tests/
# Analyze URL and generate POM
playwright-test-generator analyze \
--url https://example.com/login \
--framework pytest \
--output ./pages/
# Analyze HTML and generate locators
playwright-test-generator extract-locators \
--html "$(cat form.html)" \
--output ./locators.json
text
playwright-test-generator interactive
Follow the guided wizard to generate tests step by step.
javascript
import { PlaywrightTestGenerator } from './src/generator.js';
const gen = new PlaywrightTestGenerator();
const result = await gen.generate({
input: 'Click the search box, type "playwright", press Enter',
framework: 'pytest-playwright',
codeType: 'standard',
pageName: 'search_page'
});
TierFeaturesRateFree≤10 generations/day, standard scripts only0 creditsProUnlimited, POM + data-driven, priority1 credit/testEnterpriseCustom frameworks, team features, SLAContact
text
src/
├── index.js # CLI entry + skill interface
├── generator.js # Core code generation logic
├── parser.js # NL → test steps parser
├── locator.js # HTML → locator extractor
└── templates/ # Code generation templates
├── pytest_pom.py.ejs
├── pytest_standard.py.ejs
├── pytest_data_driven.py.ejs
├── jest_pom.ts.ejs
├── jest_standard.ts.ejs
└── native_pom.ts.ejs
javascript
{
action: 'click' | 'fill' | 'press' | 'navigate' | 'wait' | 'assert' | 'hover' | 'select' | 'check' | 'uncheck',
target: string, // CSS selector, XPath, or role-based
value?: string, // Input value or expected result
options?: {
timeout?: number,
force?: boolean,
expect?: 'visible' | 'hidden' | 'enabled' | 'disabled'
}
}
Priority order for element selection:
data-testid attribute (most reliable)role + accessible name (a11y-first)id attributeVariableDescription{{pageName}}Page object name (PascalCase){{baseUrl}}Target URL{{steps}}Array of parsed test steps{{locators}}Map of element name → selector{{testData}}Data-driven test data{{framework}}Target framework{{imports}}Required imports