WebdriverIO How to implement Page Object Model

Automation Step by Step January 3, 2023
Video Thumbnail
Automation Step by Step Logo

Automation Step by Step

@raghavpal

About

Simple Basic Beginners Step-by-Step tutorials ❤️ I create videos on Automation, Testing, DevOps, CI and related tools, technologies and platform Raghav is a teacher and founder of AutomationStepByStep.com He was an Automation Architect and has led multiple teams of Automation and DevOps Engineers. For over a decade, Raghav witnessed, worked, and delivered multiple Automation Testing Projects and worked with some awesome people in this industry ► https://automationstepbystep.com/ Some topics covered: - Jenkins - JMeter - Selenium - Appium - Cypress - Playwright - Katalon Studio - API Testing - Postman - Docker - Kubernetes - Other DevOps topics Words from Raghav We often need someone to hold our hand and help us take the first few steps before we learn to walk and run. I am on a mission to spread education and make it available to anyone willing to learn Never Stop Learning Raghav All education here is FREE FOR ALL, FOREVER Share with as many people as you can in your lifetime

Video Description

*ALL FREE COURSES* ► https://automationstepbystep.com/ 00:00 Intro 00:46 What is Page Object Model 03:04 Advantages of POM 03:22 DEMO How to implement POM in WebdriverIO Project 03:49 Sample demo application for testing 04:23 Sample Login test 16:20 Run demo test 16:54 Start of Page Object Model Implementation 17:08 Create class for each page 18:26 Create object locators in the login page class 21:24 Create functions for action on the objects 26:56 Refer the class in test script 30:30 Run POM test 33:06 Outro *What is POM* Design pattern to create Object Repository A class is created for each page to identify web elements of that page Also contains methods to do action on the objects Separates test objects and test scripts *Advantages of POM* Makes code maintainable Changes and updates are easier Makes code reusable Improves readability Single Object Repository Saves time and efforts Avoid rework Makes tests less brittle New tests creation is easier and faster Improves Overall quality and efficiency Demo How to implement Page Object Model Step 1 - Create a class for each page Step 2 - Create locators of all objects to be used in that page Step 3 - Create methods or actions to be performed on the objects Step 4 - Refer in the test scripts Step 5 - Run and validate class LoginPage class LoginPage { get username(){ return $('#username') } get password(){ return $('#password') } get loginButton(){ return $('button[type="submit"]') } get messageBox(){ return $('#flash') } async login(username, password){ await this.username.setValue(username) await this.password.setValue(password) await this.loginButton.click() } async checkLoginMessage(message){ await expect(this.messageBox).toHaveTextContaining(message) } } module.exports = new LoginPage(); Login test const LoginPage = require('../pageobjects/login.page') describe('Demo Test', () => { it('Login Test', async () => { browser.url('https://the-internet.herokuapp.com/login') await LoginPage.login('tomsmith', 'SuperSecretPassword!') await LoginPage.checkLoginMessage('You logged into a secure area!') }) }) *ASK RAGHAV* ► https://bit.ly/2CoJGWf *CI CD DEVOPS* JENKINS BEGINNER ► https://bit.ly/2MIn8EC JENKINS TIPS & TRICKS ►https://bit.ly/2LRt6xC JENKINSFILE ► https://bit.ly/3JSMSZ7 DOCKER ► https://bit.ly/2MInnzx KUBERNETES ► http://bit.ly/2MJIlMK *UI TESTING* SELENIUM BEGINNERS ► https://bit.ly/2MGRS8K SELENIUM JAVA FRAMEWORK ► https://bit.ly/2N9xvR6 SELENIUM PYTHON ► https://bit.ly/2oyMp5x SELENIUM TIPS ► https://bit.ly/2owxc50 SELENIUM BUILDER ► https://bit.ly/2MKNtlq SELENIUM 4 ► https://bit.ly/3AiJOlP KATALON STUDIO ► https://bit.ly/2wARFdi ROBOT FRAMEWORK with RIDE ► https://bit.ly/2Px6Ue9 ROBOT FRAMEWORK with Eclipse► http://bit.ly/2N8DZxb PROTRACTOR ► http://bit.ly/2KtqVkU ACCELQ ► https://bit.ly/3PlsAsh TEST PROJECT ► http://bit.ly/2DRNJYE CUCUMBER BDD ► https://bit.ly/3Cnno4z CYPRESS ► https://bit.ly/3PpEukM XPATH & WEB LOCATORS ► https://bit.ly/3PpEvoQ *API TESTING* WEB SERVICES (API) ► https://bit.ly/2MGafL7 SOAPUI ► https://bit.ly/2MGahmd POSTMAN ► https://bit.ly/2wz8LrW POSTMAN 2022 ► https://bit.ly/3JWm4qX JMETER API TESTING ► https://bit.ly/3AgVPar GENERAL ► https://bit.ly/2PYdwmV KATALON STUDIO API ► https://bit.ly/2BwuCTN REST ASSURED ► https://bit.ly/3zUdhRD KARATE API ► https://bit.ly/3w3H5Ku API MOCKING ► https://bit.ly/3bYPsjS *IDE* Visual Studio Code ► https://bit.ly/2V15yvt *PROGRAMMING* JAVASCRIPT ► http://bit.ly/2KJDZ8o TYPESCRIPT ► https://bit.ly/3dvJBmz *MOCK INTERVIEWS* ► https://bit.ly/3QGwwVJ ▬▬ *RAGHAV PAL* GITHUB PROJECTS ► https://github.com/Raghav-Pal/ STORIES BY RAGHAV ► https://automationstepbystep.com/stories/ ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ You can support my mission for education by sharing this knowledge and helping as many people as you can If my work has helped you, consider helping any animal near you, in any way you can *NEVER STOP LEARNING* Raghav Pal

You May Also Like

Slimy Fun Essentials

AI-recommended products based on this video

Loading...
Gorilla Super Glue XL Liquid, Fast-Setting, Versatile Cyanoacrylate Glue, Anti-Clog Cap, Flow Control Formula, Clear, 25g

Gorilla Super Glue XL Liquid, Fast-Setting, Versatile Cyanoacrylate Glue, Anti-Clog Cap, Flow Control Formula, Clear, 25g

(4,366)
$10.97
FREE delivery Sun, Apr 5 on your first order
1K+ bought in past month
Loading...
Gorilla Super Glue Gel, Fast-Setting, Thick Formula with Anti-Clog Cap, Clear Cyanoacrylate, 0.53oz/15g, Pack of 1

Gorilla Super Glue Gel, Fast-Setting, Thick Formula with Anti-Clog Cap, Clear Cyanoacrylate, 0.53oz/15g, Pack of 1

(1,957)
$9.97$8.15
FREE delivery Mon, Sep 15 on your first order
5K+ bought in past month
Loading...
Clip in Hair Tinsel, Clips on Hair Tensile Champagne Gold, Pack of 12Pcs, 20 inch Glitter Tinsel Extensions, Festival Fairy (Champagne)

Clip in Hair Tinsel, Clips on Hair Tensile Champagne Gold, Pack of 12Pcs, 20 inch Glitter Tinsel Extensions, Festival Fairy (Champagne)

(0)
$16.95
$7.95 delivery Jan 7 - 16
Loading...
Anne Klein Women's Bangle Watch and Premium Crystal Accented Bracelet Set

Anne Klein Women's Bangle Watch and Premium Crystal Accented Bracelet Set

(1,777)
$94.40
FREE delivery Thu, Jun 19
Loading...
COZSINOOR Queen Size Cooling Bed Pillows - Premium Down Alternative Pillows Set of 2 for Side, Back, and Stomach Sleepers Hotel Quality Fluffy Soft Microfiber Fill Breathable Skin-Friendly

COZSINOOR Queen Size Cooling Bed Pillows - Premium Down Alternative Pillows Set of 2 for Side, Back, and Stomach Sleepers Hotel Quality Fluffy Soft Microfiber Fill Breathable Skin-Friendly

(27)
$80.00
FREE delivery Mon, Jun 16
Loading...
JSWF Bed Pillows for Sleeping Queen Size 2 Packs,Ultra Soft Fluffy ,Premium Soft Down Alternative Fill Set of 2 for Back,Zipper Opening Design, can add and Remove Filler According to Your Needs

JSWF Bed Pillows for Sleeping Queen Size 2 Packs,Ultra Soft Fluffy ,Premium Soft Down Alternative Fill Set of 2 for Back,Zipper Opening Design, can add and Remove Filler According to Your Needs

(285)
$22.94
FREE delivery Sun, Mar 29 on your first order
800+ bought in past month
Loading...
Anne Klein Women's Premium Crystal Accented Watch and Bracelet Set, AK/3584, Rose Gold, AK/3584RGST

Anne Klein Women's Premium Crystal Accented Watch and Bracelet Set, AK/3584, Rose Gold, AK/3584RGST

(468)
$113.23
FREE delivery Thu, Jun 19
Loading...
Magnetic Nasal Strips Starter Kit: Comfortable Nasal Breathing Support for Sleep, Helps Reduce Snoring Noise, Includes 60 Tabs (30 Uses) with 4 Sizes

Magnetic Nasal Strips Starter Kit: Comfortable Nasal Breathing Support for Sleep, Helps Reduce Snoring Noise, Includes 60 Tabs (30 Uses) with 4 Sizes

(40)
$17.99
FREE delivery Wed, Mar 18 on your first orderOnly 7 left in stock.
1K+ bought in past month
Loading...
Environet Hydroponic Growing Kit, Self-Watering Mason Jar Herb Garden Starter Kit Indoor, Windowsill Herb Garden, Grow Your Own Herbs from Organic Seeds (Basil)

Environet Hydroponic Growing Kit, Self-Watering Mason Jar Herb Garden Starter Kit Indoor, Windowsill Herb Garden, Grow Your Own Herbs from Organic Seeds (Basil)

(786)
$69.15$33.51
FREE delivery Jun 13 - 17
Loading...
Herb Garden Planter Indoor Kit 21Pcs Kitchen Herb Garden Starter Kit Growing Kit Including Wooden Box Burlap Pots Soil Discs Gardening Tools Unique Easter Birthday Christmas Gift Ideas for Women Mom

Herb Garden Planter Indoor Kit 21Pcs Kitchen Herb Garden Starter Kit Growing Kit Including Wooden Box Burlap Pots Soil Discs Gardening Tools Unique Easter Birthday Christmas Gift Ideas for Women Mom

(0)
$30.99
FREE delivery Jun 19 - Jul 3
Loading...
Bonsai Starter Kit – 1x Bonsai Tree | Complete Indoor Starter Kit for Growing Plants with Bonsai Seeds, Tools & Planters – Gardening Gifts for Women & Men
Best Seller

Bonsai Starter Kit – 1x Bonsai Tree | Complete Indoor Starter Kit for Growing Plants with Bonsai Seeds, Tools & Planters – Gardening Gifts for Women & Men

(243)
$19.99
FREE delivery Sat, Jun 14 on your first order
300+ bought in past month
Loading...
Auréa Custom Heart-Shaped Magnet Bottle Opener – Personalized Wedding Favor, Bridal Shower Gift for Guests, Thank You Souvenir (Pack of 30) (Only Bottle Opener)

Auréa Custom Heart-Shaped Magnet Bottle Opener – Personalized Wedding Favor, Bridal Shower Gift for Guests, Thank You Souvenir (Pack of 30) (Only Bottle Opener)

(0)
$54.90
$13.90 delivery Jul 10 - 15