Playwright practice for beginners: a four-week plan
Reading the Playwright docs teaches you the API. Practice teaches you what to do when a locator matches three buttons, an element loads late or a form sits inside an iframe. This plan takes you from an empty folder to a full end-to-end suite in four weeks, at about four to five hours a week.
Every exercise runs against this site, so there's nothing to install except Playwright itself. Each one has a brief with the steps to test and a full solution to compare with yours when you're done.
Before you start: set up a project
You need Node.js 20 or newer. Create a project in an empty folder and accept the defaults (TypeScript, a tests folder):
npm init playwright@latestThen point the tests at this site, so page.goto('/basic/buttons') opens the exercise. In playwright.config.ts:
export default defineConfig({
use: {
baseURL: 'https://playwright-playground.com',
},
});Three commands cover most of your day:
npx playwright test # run every test
npx playwright test --ui # UI mode: watch, step through, pick locators
npx playwright show-report # the HTML report of the last runWrite one test file per exercise, for example tests/buttons.spec.ts. Mark the exercise as solved on its page when your test passes. Your progress is kept in the browser, with no account.
Week 1: locators, actions and assertions
Learn the core loop of every test: find an element, act on it, and assert the result. Use getByRole and getByLabel from day one, and always await your expect calls.
- ButtonsBeginnerClick, double-click and right-click, and why { exact: true } matters.
- InputsBeginnerFill text, email, number, date and range inputs.
- CheckboxesBeginnercheck(), uncheck() and setChecked().
- Radio ButtonsBeginnerRadio groups and disabled options.
- DropdownBeginnerNative selects and a custom dropdown.
- Content & AttributesBeginnerAssert text, values, attributes and state.
By the end of the week, read the locators guide and try the Locator Challenges.
Week 2: forms, waiting and dialogs
Real forms validate, load data late and show dialogs. This week you'll stop reaching for waitForTimeout(): Playwright waits for you, if you let it.
- Login FormBeginnerEvery path of a login form, including a lockout.
- Appear & DisappearBeginnerLate elements, spinners and toasts without sleeps.
- Changing TextBeginnerText that changes while you assert it.
- Form ValidationIntermediateValidation on submit, on blur and on the server.
- JavaScript DialogsBeginneralert, confirm and prompt dialogs.
- HoverBeginnerHover menus and tooltips.
The auto-waiting guide explains what Playwright waits for and why tests turn flaky.
Week 3: tables, frames, files and windows
The harder parts of real apps: data in tables, forms in iframes, files going in and out, and links that open new tabs.
- Basic TableBeginnerFind rows and cells by their content.
- iFrame BasicsBeginnerWork inside an iframe.
- File UploadIntermediateUpload files without the system dialog.
- File DownloadIntermediateCatch downloads and check their contents.
- Tabs & WindowsAdvancedNew tabs, popups and a sign-in window.
- Keyboard ActionsBeginnerTyping, Tab order and keyboard shortcuts.
Week 4: the network and a full end-to-end suite
Finish with what real test suites spend most of their effort on: controlling the network, reusing a signed-in session, and testing a complete shop from search to order confirmation.
- Network MockingAdvancedMock responses, errors and slow requests.
- Sign In & SessionsAdvancedSign in once and reuse the session with storageState.
- First E2E TestIntermediateBuy a laptop in the Mini Shop, from search to confirmation.
- Page Objects & FixturesAdvancedRefactor it into Page Objects and fixtures.
Habits that make the practice stick
- Write the test before you open the solution. Struggling with a locator for ten minutes teaches more than reading the answer.
- Make it fail on purpose. Change an expected value and read the error. You'll need to read errors like it at work.
- Run it 20 times.
--repeat-each=20finds flaky tests before CI does. - Read failures with a trace. Run with
--trace onand open the Trace Viewer instead of adding console logs.
- Reading FailuresBeginnerRead five real Playwright errors and fix each test.
- Trace ViewerIntermediateFind a bug with the Trace Viewer.
Exercises in this guide
- ButtonsBeginner
- InputsBeginner
- CheckboxesBeginner
- Radio ButtonsBeginner
- DropdownBeginner
- Content & AttributesBeginner
- Login FormBeginner
- Appear & DisappearBeginner
- Changing TextBeginner
- Form ValidationIntermediate
- JavaScript DialogsBeginner
- HoverBeginner
- Basic TableBeginner
- iFrame BasicsBeginner
- File UploadIntermediate
- File DownloadIntermediate
- Tabs & WindowsAdvanced
- Keyboard ActionsBeginner
- Network MockingAdvanced
- Sign In & SessionsAdvanced
- First E2E TestIntermediate
- Page Objects & FixturesAdvanced
- Reading FailuresBeginner
- Trace ViewerIntermediate
More guides
- Playwright locators: a practical guide with exercises
- Playwright auto-waiting: how to fix flaky tests
- Testing iframes with Playwright
- Playwright network mocking and API testing
- Playwright authentication: sign in once with storageState
- Playwright Page Object Model with fixtures
- File upload and download in Playwright
- Playwright Trace Viewer: how to debug failing tests
- Running Playwright tests in CI with GitHub Actions
- Playwright cheat sheet: locators, actions and assertions