What Is Playwright? Test Automation for Beginners
Playwright is a free, open-source tool from Microsoft that controls a browser with code. You use it to test websites: open a page, click buttons, type text and check what appears.
Why testers like it
- It waits for you. Playwright waits until a button is ready before clicking, so tests fail less often.
- Three browsers. The same test runs in Chromium (Chrome), Firefox and WebKit (Safari).
- Great evidence. It can save screenshots, videos and a trace you can replay when a test fails.
- One tool for UI and API. You can test web pages and call APIs in the same project.
Your first test
After installing Node.js, run npm init playwright@latest in an empty folder. Then a test looks like this:
import { test, expect } from '@playwright/test';
test('home page has the right title', async ({ page }) => {
await page.goto('https://playwright.dev/');
await expect(page).toHaveTitle(/Playwright/);
});
Run it with npx playwright test. A passing test prints a green tick.
Which language?
Playwright supports JavaScript, TypeScript, Python, Java and C#. Most beginners start with JavaScript because the tool is easiest to use there.
What to learn next
Locators (how to find things on a page), assertions (how to check results), and the Page Object Model (how to keep tests tidy).
Want to practise this step by step?
Our free Playwright course teaches it in simple English, one day at a time.
Open the free course
Our free Playwright course teaches it in simple English, one day at a time.
Open the free course