Open-source npm tool that converts Java + Selenium + TestNG, C# NUnit, Cucumber BDD, and SpecFlow test suites into modern Playwright TypeScript. Rule-based and AST-driven; locator strategies, waits, Page Objects, and step definitions rewritten cleanly. Optional multi-LLM fallback (Anthropic / OpenAI / Gemini) for the long tail.
Install
$ npm install --save-dev @vijaypjavvadi/sel2pw
Point it at a Selenium test file or directory and a target language. sel2pw parses the AST, maps every Selenium concept to its Playwright equivalent, and emits idiomatic TypeScript that compiles cleanly on the first run.
@Test
public void testValidLogin() {
driver.get("https://acme.com/login");
driver.findElement(By.id("email"))
.sendKeys("a@b.c");
driver.findElement(By.cssSelector(".submit"))
.click();
new WebDriverWait(driver, 5)
.until(ExpectedConditions
.urlContains("/dashboard"));
}
import { test, expect } from '@playwright/test';
test('valid login', async ({ page }) => {
await page.goto('https://acme.com/login');
await page.locator('#email').fill('a@b.c');
await page.locator('.submit').click();
await expect(page).toHaveURL(/\/dashboard/);
});
Four source frameworks
Java + Selenium + TestNG · C# NUnit · Cucumber BDD · SpecFlow. AST-based parsing — not regex tricks.
Idiomatic Playwright output
Emits modern Playwright using auto-waiting locators, web-first assertions, and async/await. No translated boilerplate.
Page Objects + steps
Selenium PageFactory classes and Cucumber step definitions get rewritten as Playwright Page Objects with the same public API.
Multi-LLM fallback
Optional --llm anthropic / openai / gemini for the long tail of obscure WebDriver patterns. Every prompt scrubbed, audited, cached.
Rule-based, not best-effort
Most translations are pure rule-based AST rewrites — no LLM in the loop. Reproducible across runs.
Powered by pw-emit
Built on @vijaypjavvadi/pw-emit, the shared emitter library that also powers bdd2pw. One IR, two front ends.
sel2pw gets you to clean Playwright code. TestForge AI is what to do with that code: generate scenarios from PRDs without writing Gherkin, run them in disposable containers, capture per-step visual baselines, classify every failure with an AI defect analyst, and draft Jira tickets automatically.
Start Free — no credit card →