Member-only story

Playwright Cheat-Sheet for Newbies

S Chathuranga Jayasinghe
4 min readOct 2, 2024

Good to know commands for Playwright beginners…

Hey there, QA Champions! 🎉 If you’re diving into web automation, then Playwright is a tool you’ll want in your testing toolkit.

Whether you’re just getting started or already familiar with it, this Playwright Cheat Sheet is designed to be your trusty sidekick. We’ll cover everything from the basics to more advanced tips, like how to handle tricky UI actions, debug tests, and write bulletproof assertions. So grab a coffee, and let’s make testing with Playwright a breeze!

Basic Playwright Commands

1. Create a New Playwright Project

npm init playwright@latest

2. Run Tests

npx playwright test

3. Run Tests in UI Mode

npx playwright test --ui

4. Run Tests in a Specific Browser

npx playwright test --project=chromium

5. Generate Code

npx playwright codegen

6. Show Playwright Report

npx playwright show-report

--

--

S Chathuranga Jayasinghe
S Chathuranga Jayasinghe

Responses (1)