🎭 Selenium → Playwright Converter (S2P)
AI-powered VSCode extension that migrates your Selenium tests to Playwright in one click.
🆓 100% Free — Bring your own API key from any of 4 free AI providers. No subscriptions. No limits.
🆕 What's New in v1.2.0
- 🎨 Live sidebar dashboard — stats, history, and provider switcher always visible in the activity bar
- 👁 Diff preview — review the converted code side-by-side before saving; Accept, Copy, or Discard
- 📁 Batch folder convert — right-click any folder to convert all Selenium files at once
- 🤖 Per-provider model picker — choose from curated models per provider or enter any custom model ID
- 📜 Conversion history — last 50 conversions tracked with provider, tokens, and pass/fail status
- 📊 Export migration report — one-click Markdown report with summary, provider breakdown, and history table
- ⌨️ Keyboard shortcuts —
Ctrl+Shift+Alt+P convert file · Ctrl+Shift+Alt+S convert selection · Ctrl+Shift+Alt+D dashboard
- 📝 Custom prompt rules — inject your own project-specific conversion rules via settings
⚡ How It Works
- Set your API key —
Ctrl+Shift+P → Selenium2PW: Set AI Provider API Key
- Right-click any Selenium test file in the Explorer
- Select "Convert Selenium → Playwright"
- Review the diff preview, then hit Save File — done!
✨ Features
- ⚡ One-click conversion — right-click any Selenium file in Explorer or Editor
- 🔀 Selection support — convert just a highlighted block of code
- 📁 Batch convert — right-click a folder to convert all files at once
- 👁 Diff preview — review changes before saving (Accept / Copy / Discard)
- 🤖 Model picker — choose from curated models per provider or enter a custom model ID
- 🌐 5 input languages — JavaScript, TypeScript, Python, Java, C#
- 📤 3 output formats — TypeScript, JavaScript, Python Playwright
- 📊 Usage dashboard — sidebar + full tab with stats, history, and provider management
- 📜 Conversion history — last 50 conversions with token usage and status
- 📊 Export report — Markdown migration report with provider breakdown
- 📝 Custom rules — inject project-specific rules into the AI prompt via
selenium2pw.customRules
- 🔒 Secure key storage — API keys stored in VSCode's built-in secrets vault
- 🗂 Non-destructive — creates a new
.playwright.ts file, never modifies the original
🤖 Supported AI Providers
✅ Free Providers — No Credit Card Required
💳 Paid Providers
| Provider |
Default Model |
| OpenAI |
GPT-4o |
| Anthropic |
Claude Sonnet 4.6 |
New in v1.2.0: Use Selenium2PW: Change AI Model to pick from a curated list or enter any custom model ID per provider.
📝 Conversion Example
Before — Selenium Python:
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
driver = webdriver.Chrome()
driver.get("https://example.com")
driver.find_element(By.ID, "username").send_keys("admin")
driver.find_element(By.CSS_SELECTOR, ".login-btn").click()
WebDriverWait(driver, 10).until(
EC.visibility_of_element_located((By.ID, "dashboard"))
)
driver.quit()
After — Playwright TypeScript:
import { test, expect } from '@playwright/test';
test.describe('Login', () => {
test('user can sign in', async ({ page }) => {
await page.goto('https://example.com');
// Auto-wait built in — no more WebDriverWait!
await page.locator('#username').fill('admin');
await page.locator('.login-btn').click();
await expect(page.locator('#dashboard')).toBeVisible();
});
});
🔑 Getting Started (Free in 2 minutes)
Groq — fastest and most generous free tier:
- Go to console.groq.com — no credit card required
- Create an API key
- In VSCode:
Ctrl+Shift+P → Selenium2PW: Set AI Provider API Key
- Paste your key — done!
⌨️ Keyboard Shortcuts
| Shortcut |
Action |
Ctrl+Shift+Alt+P |
Convert active file |
Ctrl+Shift+Alt+S |
Convert selected code |
Ctrl+Shift+Alt+D |
Open dashboard |
⚙️ Configuration
{
"selenium2pw.aiProvider": "groq",
"selenium2pw.outputLanguage": "typescript",
"selenium2pw.createNewFile": true,
"selenium2pw.showDiffPreview": true,
"selenium2pw.customRules": [
"Use data-testid attributes where available",
"Replace myCustomWait() with page.waitForSelector()"
]
}
| Setting |
Options |
Default |
aiProvider |
groq · gemini · openrouter · deepseek · openai · anthropic |
groq |
outputLanguage |
typescript · javascript · python |
typescript |
createNewFile |
true · false |
true |
showDiffPreview |
true · false |
true |
customRules |
array of strings |
[] |
modelOverrides |
object per provider |
{} |
🚀 Commands
| Command |
Description |
Selenium2PW: Convert Selenium → Playwright |
Convert the active file |
Selenium2PW: Convert Selected Code → Playwright |
Convert selected code only |
Selenium2PW: Batch Convert Folder → Playwright |
Convert all files in a folder |
Selenium2PW: Change AI Model |
Pick or enter a model for the current provider |
Selenium2PW: Export Migration Report |
Export Markdown report of all conversions |
Selenium2PW: Open Usage Dashboard |
View stats, history & manage API keys |
Selenium2PW: Set AI Provider API Key |
Store your API key securely |
🔒 Privacy
- API keys stored in VSCode's built-in secret storage — never in plaintext
- Your code is sent only to your chosen AI provider — not to any other server
- No account required, no data collected
📬 Support
Made for the testing community — happy migrating! 🎭