
In this introductory module, you will learn the fundamentals of Playwright, an open-source test automation framework developed by Microsoft. We'll guide you through why Playwright is gaining popularity, how it compares to other tools like Selenium, and what makes it stand out in the automation landscape. You’ll also learn how to set up your development environment to start writing Playwright tests smoothly and efficiently. Whether you're new to test automation or looking to enhance your skills, this module will equip you with the knowledge to begin your journey with Playwright.
This module focuses on setting up a practical development environment for Playwright test automation using Java. You'll learn how to install and configure essential tools like Java, Maven, and your preferred integrated development environment (IDE) to ensure a smooth workflow. We’ll guide you through using IntelliJ IDEA, the recommended IDE for Java development, though you can follow along with Eclipse or Visual Studio Code if you prefer. By the end of this module, your environment will be ready to write and execute your first Playwright script.
The versions you will need to run the code samples are:
Java 17 or higher
Maven 3.9.9
Write your first Playwright test in Java using IntelliJ and Maven.
Build on your first test and learn how to interact with elements on a page using Playwright.
Learn how to make your tests simpler and leaner with fixtures and the @UsePlaywright annotation.
Learn how Playwright uses browser contexts to run tests in isolated sessions, enabling multiple contexts, separate cookies and local storage, and parallel execution for efficient testing.
Understand how browser contexts work in Playwright and why sharing a single context across tests boosts isolation and efficiency.
Discover how to locate elements with Playwright by text value, alt text, or title, then click and assert visibility across a product page.
Master Playwright's role-based locators to find elements semantically via aria roles and names, enabling resilient, accessible tests across buttons, dialogs, checkboxes, and headings.
Locate elements reliably with a test ID, such as data test ID, independent of HTML structure. Use Playwright selectors to set and get by test ID for stable element lookup.
Explore how to locate and manipulate collections of elements with Playwright, using CSS class selectors like card, and perform counts, first/last/nth selections, and retrieve all text contents.
Explore CSS locators in Playwright by locating elements via id, class, and placeholder, entering values like Sarah Jane, clicking submit, and validating alerts with assertions.
Watch a live coding demo on using Playwright locators to search for pliers, verify four results, and confirm that long nose pliers are out of stock.
Refactor tests with the UsePlaywright annotation to inject page, browser, or Playwright objects, removing explicit before/after setup and centralizing options in a configurable headless Chrome options class.
See a live coding demo testing mandatory form fields, submitting empty forms to reveal alert messages, and validating errors like 'first name is required' with a JUnit 5 parameterized test.
Use assertj with Playwright to extract and assert on data such as product prices, converting text to numbers and applying comprehensive collection assertions. Verify list order with case-insensitive sorting.
Learn how Playwright handles asynchronous pages with automatic waits and retries, why to avoid hard-coded pauses, and how to use wait for selector to verify product names and images.
Discover how Playwright automatically waits for elements to render, enabling interaction with checkboxes without explicit waits and validating results with assertions.
Mastering modern test automation with Playwright demonstrates waiting for elements to appear and disappear, using intermediate assertions and explicit wait conditions to verify toaster messages, aria alerts, and cart updates.
Learn to wait for an API response with Playwright, not a UI event, by waiting for the product sort API and validating prices in descending order to reduce flaky tests.
Expand test coverage for a search feature in a Playwright for Java project by adding readable tests for empty searches, no matches, and clear search using JUnit 5 display names.
Learn to call real APIs from Playwright, fetch product data (name and price) via an API request context, and verify on-page results using has text filters.
Create a Java record for a user and populate it with random data via Data Faker, covering first name, last name, address, city, postcode, email, date of birth, and password.
In this section we show how to create a randomised User domain class for our tests. Note that we use a similar approach in the previous module as well for the API tests.
NOTE: The API structure in the application has evolved slightly since the videos in this section were recorded - notably, the user address is now recorded as a nested object, rather than as a flat set of fields. This is reflected in the sample code.
Most Playwright tests work at first. Then they start to fall apart.
AI can generate Playwright tests in seconds.
Keeping them consistent over time is where it gets hard.
A few weeks in, the same flows start appearing in slightly different forms. Assertions don’t quite line up anymore.
Someone fixes a selector in one place but not another.
Then a small UI change lands, and suddenly half the suite is red.
At that point, it’s not obvious what’s wrong. The code looks reasonable. It runs. But it doesn’t behave the same way twice.
That’s usually a design problem, not a tooling problem.
And it’s something I’ve seen repeatedly in large teams and long-lived systems.
That’s what this course is about.
Playwright itself isn’t the hard part. Writing a test that passes isn’t the hard part either.
What’s difficult is ending up with a test suite that still makes sense as it grows.
One where changes don’t ripple unpredictably, and where you don’t have to stop and think “why was this written this way?” every time you open a file.
That’s what this course focuses on.
You’ll build out a Playwright framework in Java step by step, but the emphasis isn’t on the mechanics.
It’s on the decisions behind it.
Why one structure holds up better than another. Why some tests become fragile even when they look clean.
We’ll work through real scenarios — authentication, API interactions, dynamic UI behaviour — the kinds of things that tend to break naive test suites.
By the end, you should have something that feels like a system, not just a collection of tests.
AI is part of that system now, whether we like it or not.
Used carefully, it’s genuinely useful. It helps explore flows, sketch out tests, and fill in the obvious gaps.
But left unchecked, it introduces a kind of quiet inconsistency.
Not dramatic failures. Just small differences that accumulate.
Nothing is obviously wrong, but nothing quite lines up either.
That’s where most teams start losing control.
So instead of treating AI as a shortcut, we treat it as something that needs boundaries.
You’ll see how to guide it so the output fits into a consistent structure.
How to keep naming, intent, and patterns aligned.
The aim isn’t to write tests faster.
It’s to make sure what you generate today still makes sense a month from now.
It’s about 15 hours of content, and it assumes you already know your way around Java and basic testing.
This isn’t about getting started. It’s about getting past the point where things start to get messy.