#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
🎭 FREE · TS · JS · PYTHON

Playwright Test Generator: Readable Tests in Seconds

Turn plain steps into a Playwright test with resilient locators and auto-waiting assertions.

  • 🎯 Role and label locators
  • ✅ Web-first assertions
  • ⚙️ Config included

How to use the Playwright Test Code Generator

  1. 1. Write the stepsOne per line, using the simple step language below the box.
  2. 2. Pick a languageTypeScript or JavaScript for @playwright/test, or Python for pytest-playwright.
  3. 3. GenerateCopy the test and the config, then run npx playwright test or pytest.

How the test is written

Each line of the box is one step. Actions are open, type, select, click, check, uncheck, hover and press; checks start with expect and cover the URL, title, visible text, visibility and field values. Selectors can be CSS, or text=, label=, placeholder=, testid= and role=, which survive design changes better than long CSS paths. Everything runs in your browser; nothing you enter is uploaded.

Selectors map to Playwright's recommended locators: getByRole, getByLabel, getByPlaceholder, getByText and getByTestId. Checks use web-first assertions such as toHaveURL and toBeVisible, which retry until they pass or time out, so you never need manual waits. The config sets your base URL, retries on CI and trace recording on the first retry.

Worked example

The sample steps open /login, fill the email by its label and the password by ID, click Log in, check the URL and the welcome text, then log out by test ID. In TypeScript that's a 13-line test. We ran the TypeScript, JavaScript and Python versions of a longer test with Playwright 1.63 against a local login page, and all three passed; the TypeScript also passes tsc --strict.

Tips

  • Use npx playwright codegen to find a good locator, then put it into the steps here.
  • Run with --ui or --trace on to debug failures step by step.
  • Keep one behaviour per test; long flows are harder to debug.

Frequently asked questions

Does it support API testing?

This generator writes browser tests. For API cases, use our API test case generator.

Which Playwright version?

The code uses stable APIs available in all recent Playwright versions; we tested with 1.63.

Is the Playwright test generator free?

Yes. You can open the Playwright test generator and fill in everything without signing up. When you generate code for the first time, we ask once for your name and WhatsApp number; after that it, and every other Uncodemy tool, opens straight away.

More free tools

See all free tools