Command equivalents at a glance
| Action | Selenium (Java) | Playwright | Cypress |
|---|---|---|---|
| Visit | driver.get(url) | await page.goto(url) | cy.visit(url) |
| Find by CSS | By.cssSelector(c) | page.locator(c) | cy.get(c) |
| Find by id | By.id("x") | page.locator("#x") | cy.get("#x") |
| Type | .sendKeys(t) | .fill(t) | .type(t) |
| Click | .click() | .click() | .click() |
| Text assert | assertEquals(x, el.getText()) | await expect(loc).toHaveText(x) | .should('have.text', x) |
How the translator works
It applies an ordered list of pattern rules line by line — driver.findElement(By.id("x")) becomes page.locator("#x"), and so on. Because it's deterministic, the same input always gives the same output, and you can trust it not to invent APIs. It's intentionally a starter mapping covering the common actions; unusual lines are passed through untouched and flagged so you can convert them by hand.
Why migrate at all?
Teams move from Selenium to Playwright or Cypress for auto-waiting, faster feedback, and simpler setup. Understanding how each command maps to the others makes the move far less daunting — and makes you more valuable as an engineer who works across all three.