Skip to main content

AI-powered Selenium to Playwright migration tool

Project description

QAMigrate

AI-powered test framework migration

Python 3.11+ License: MIT

A QATonic Innovations product.


QAMigrate converts test suites between frameworks automatically. It parses your code with Tree-sitter, generates equivalent code with Claude, and validates the output with the target language's compiler.

Today: Selenium Java -> Playwright Java Next: Cypress -> Playwright, TestNG -> JUnit 5, RestAssured -> Karate, and more.

What it does

Give it a Selenium file:

// Selenium
@FindBy(id = "username")
private WebElement usernameInput;

public void login(String user, String pass) {
    usernameInput.clear();
    usernameInput.sendKeys(user);
    passwordInput.sendKeys(pass);
    wait.until(ExpectedConditions.elementToBeClickable(loginButton));
    loginButton.click();
}

Get Playwright back:

// Playwright (generated by QAMigrate)
private final Locator usernameInput;

public LoginPage(Page page) {
    this.usernameInput = page.locator("#username");
}

public void login(String user, String pass) {
    usernameInput.fill(user);
    passwordInput.fill(pass);
    loginButton.click(); // Playwright auto-waits
}

Supported patterns

  • @FindBy annotations (id, css, xpath, className, name, linkText)
  • PageFactory.initElements removal
  • WebDriverWait / ExpectedConditions removal (Playwright auto-waits)
  • sendKeys -> fill, clear removal, click direct conversion
  • Actions (hover, drag) -> Playwright equivalents
  • Select dropdowns -> selectOption
  • JavascriptExecutor -> page.evaluate()
  • Alert/iframe handling
  • File uploads -> setInputFiles
  • TestNG -> JUnit 5 lifecycle (@BeforeMethod -> @BeforeEach, etc.)
  • @DataProvider -> @MethodSource
  • Assert.assertEquals/assertTrue -> Playwright assertions
  • ChromeDriver setup -> Playwright.create() + browser.newContext()
  • Base class inheritance preservation

Quick start

Prerequisites

Install

pip install qamigrate

Or from source:

git clone https://github.com/qamigrate/qamigrate.git
cd qamigrate
pip install -e .

Configure

# Set your API key
echo "ANTHROPIC_API_KEY=sk-ant-your-key" > .env

# Or export directly
export ANTHROPIC_API_KEY="sk-ant-your-key"

Migrate

# Initialize in your Selenium project
qamigrate init --project ./my-selenium-project

# Scan to see what patterns are detected
qamigrate scan --project ./my-selenium-project

# Migrate a single file
qamigrate migrate LoginPage.java --project ./my-selenium-project

# Migrate everything
qamigrate migrate --all --project ./my-selenium-project

Output goes to a playwright/ subdirectory next to each original file.

CLI commands

Command Description
qamigrate init Initialize QAMigrate in a Selenium project
qamigrate scan Analyze codebase, detect patterns, show complexity
qamigrate migrate Convert files to Playwright
qamigrate dashboard Launch the web UI
qamigrate export Export migration results as ZIP or report

How it works

Scanner (Tree-sitter)     Deterministic AST parsing, 70+ pattern detection
       |
Coder (Claude API)        Generates Playwright Java via structured output
       |
Compiler (javac)          Validates generated code compiles
       |
Fixer (rules + Claude)    Fixes compilation errors, retries up to 3x
       |
Output                    Clean Playwright Java file

No frameworks, no LangChain -- just a plain Python pipeline calling each step in sequence.

Configuration

Create qamigrate.yaml in your project root (or run qamigrate init):

coder:
  model: "claude-sonnet-4-20250514"
  max_tokens: 8192

compiler:
  build_tool: "maven"    # or "gradle"
  java_version: "17"
  skip: false            # set true if Playwright JARs not available locally

supervisor:
  max_retries: 3

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run linter
ruff check src tests

# Run tests
pytest tests -v

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qamigrate-0.1.0.tar.gz (245.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qamigrate-0.1.0-py3-none-any.whl (86.5 kB view details)

Uploaded Python 3

File details

Details for the file qamigrate-0.1.0.tar.gz.

File metadata

  • Download URL: qamigrate-0.1.0.tar.gz
  • Upload date:
  • Size: 245.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for qamigrate-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0642cd20a487337bb9d593daa0a323fdfeedd36f5d2cb96e2a7a2d74e23b8da9
MD5 319a4db5ebcc0a162329e6e96f3ed1f6
BLAKE2b-256 18213bc565f7b230e4a7f98d837079923e81616dc6adb95c5b8b5bddf21ae51c

See more details on using hashes here.

File details

Details for the file qamigrate-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: qamigrate-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 86.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for qamigrate-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2ebd8a51a921abd8a489b2a64ea9a7af98210aac3d3630a19c43546d1e40c5f6
MD5 a1b4572f23952c589510691347176575
BLAKE2b-256 3044796282d73842caa63872ff5de2849164373e226129444cad927398df582a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page