Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Playwright Page Object Model - Step by Step Demo

Automation Step by Step via YouTube

Overview

Google, IBM & Meta Certificates – 40% Off
One Coursera Plus subscription covers most Professional Certificates on Coursera.
Unlock All Certificates
This beginner course demonstrates how to set up a Node.js Playwright project, create a login test, and organize it with page objects containing locators and action methods. Learners run the test and inspect the results.

Syllabus

Introduction
Step 1 - Create a new folder and open in IDE or Editor like VS Code
Step 2 - Initialize a new Node.js project by running npm init -y to create a package.json file
Step 3 - Install & Setup Playwright by running npm init playwright@latest
Step 4 - Create a demo login test, can use Test Generator to record npx playwright codegen
Step 5 - Run tests and check results - npx playwright test & npx playwright show-report
Step 6 - Create new folder "pages" in your project, this will contain all page objects
Step 7 - Create a new file and class for each page e.g. login.js and LoginPage
Step 8 - In the class create element locators & action methods for login page
Step 9 - In test file, import the page class, create instance of it, & use methods from LoginPage class
Step 10 - Run the test npx playwright test and check results
Upload project on GitHub

Taught by

Automation Step by Step

Reviews

Start your review of Playwright Page Object Model - Step by Step Demo

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.