From Selenium
Rewrite Selenium flows in TypeScript with locators, retrying assertions, and agent goals.
e2e replaces a Selenium suite with TypeScript tests. Locators find nodes by role and label, and assertions retry until they pass or time out. A Java or Python suite needs a rewrite, so run both suites and move one flow at a time.
For a migration that spans several sessions, the migrate-to-e2e skill records what moved in a progress file and keeps the old suite running until you retire each test.
Port the config
Rewrite one flow
Start with one page object and the flows that use it.
driver.get("http://localhost:3000/login");
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
wait.until(visibilityOfElementLocated(By.id("username"))).sendKeys("admin@example.test");
driver.findElement(By.id("password")).sendKeys(System.getenv("ADMIN_PASSWORD"));
driver.findElement(By.xpath("//button[contains(., 'Sign in')]")).click();
wait.until(urlContains("/dashboard"));
assertEquals("Welcome back, admin!",
driver.findElement(By.cssSelector(".greeting")).getText());import { test } from '@e2e-dev/web';
import { expect, credentials } from 'e2e';
test('signs in', async ({ app, screen, browser }) => {
const admin = credentials.user('admin');
await app.open('/login');
await screen.getByLabel('Username').fill(admin.username);
await screen.getByLabel('Password').fill(admin.password);
await screen.getByRole('button', 'Sign in').tap();
await expect(browser).toHaveURL('/dashboard');
await expect(screen.getByRole('status')).toHaveText('Welcome back, admin!');
});Locator actions wait for their targets, so no explicit wait is left. The password comes from configured credentials.
Map each WebDriver call
findElement takes the first match. e2e fails with LOCATOR_AMBIGUOUS on
several, so narrow with .filter(), .first(), or .nth().
