Menu
×
   ❮   
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP C C++ C# AWS W3.CSS HOW TO BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SWIFT SASS VUE GEN AI SCIPY CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING HTML & CSS BASH RUST TOOLS MATH

Playwright Tutorial

Learn Playwright

Playwright is a free tool from Microsoft that tests websites in real browsers.

You write a test in JavaScript that opens a page, clicks and types like a user, and checks that the page shows the right result.

Playwright runs the test in Chromium, Firefox and WebKit.


Share

What You Will Learn

This tutorial teaches you to write and run end-to-end tests with Playwright and JavaScript.

You will learn:

  • What Playwright is, and how to set up a project
  • How to write a test and run it from the command line
  • How to find elements with locators, act on them, and check the result with assertions
  • How to use the Playwright tools: Codegen, the Trace Viewer, UI mode and the HTML report
  • How to configure browsers, retries, parallel runs and reporters
  • Advanced topics: page objects, fixtures, login, network mocking, API testing, visual comparisons and running tests in CI

The last chapters show how to use Playwright with Python.


Learn with Practice Pages

All the examples test our own practice pages, made for this tutorial: Playwright Practice Pages.

There is a login page, a todo list, a sign up form and a small shop.

You can run every example on your own computer, against the same pages, and get the same result.



Why Learn Playwright?

Playwright tests a website the way a user uses it, from the first click to the last page.

This is called end-to-end testing.

Reasons to learn Playwright:

  1. One test runs in all major browser engines: Chromium, Firefox and WebKit
  2. Auto-waiting: Playwright waits for elements to be ready, so your tests are stable
  3. Good tools: a test generator, a trace viewer, a UI mode and an HTML report are built in
  4. It is free and open source

Prerequisites

You should know basic JavaScript before you start.

Playwright runs on Node.js, so you should also know how to run a command in a terminal and what npm is.

If you are new to these, start with our JavaScript Tutorial and our Node.js Tutorial.


Free account

Track your progress

XP earned 0 Day streak 0 Spaces 0 League —

New

Learn in Adventure Mode W3Schools Adventure App

Coding fundamentals as bite-sized lessons and challenges.

×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookies and privacy policy.

Copyright 1999-2026 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.