Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Learn Playwright with Javascript
Rating: 4.6 out of 5(1,016 ratings)
6,015 students

Learn Playwright with Javascript

Mastering Web & API Automation with Playwright
Created byPavan Kumar
Last updated 4/2025
English

What you'll learn

  • Web Automation with Playwright
  • API Testing with Playwright
  • JavaScripting
  • Frameworks

Course content

7 sections59 lectures22h 26m total length
  • Introduction24:30
  • Installation & Environment Setup28:04


    https://youtu.be/cnnkb0AuIFI


    node -v   or    node --version

    npm -v   or  npm --version



    Install using command as npm package


    Step 1 - Create a new folder and open in VS Code


    Step 2 - Goto Terminal and run command - npm init playwright@latest


    Step 3 - Following will be added

      - package.json - node project management file

      - playwright.config.js - Configuration file

      - tests folder -  basic example test

      - tests-examples folder - detailed example tests

      - .gitignore - to be used during git commit and push

      - playwright.yml - to be used during ci cd pipeline (github workflows)


    Step 4 - Check playwright added - npm playwright -v

    Step 5 - Check playwright command options - npx playwright -h


    Using VS Code extension

    ------------


    Step 1 - Create a new folder and open in VS Code


    Step 2 - Goto Extensions section and install Playwright extension from Microsoft


    Step 3 - Goto View - Command Palette and type playwright - select install playwright


    Step 4 - Select the browsers and click ok


    Step 5 - It will install the libraries and create the project folders


    to run test....


    npx playwright test


    to get report.....


    npx playwright show-report


    npx playwright test --headed




  • How To Create and Running Tests in Playwright/VS Code editor34:16

    2 different ways

    -----

    1) Without using plugin Codegen - Test Generator

    2) Codegen - Test Generator


    ------------


    Step 1 - Create a new file under test folder

    Step 2 - Add module ‘playwright/test’


        const { test, expect } = require('@playwright/test');

       

        ** test, expect ---> functions from @playwright/test module



    Playwright Test provides a test function to declare tests and expect function to write assertions


    Step 3 - Create a test block - test(title, testFunction)


    test('My First Test',  async ({page}) => {

        await page.goto('https://google.com');

        await expect(page).toHaveTitle('Google');

    })


    The keyword 'async' before a function makes the function return a promise

    The keyword 'await' before a function makes the function wait for a promise


    to run login test

    --------

    npx playwright test --project=chromium --headed FirstTest.spec.js



    npx playwright test        runs all tests on all browsers in headless mode


    npx playwright test  MyTest1.spec.js     runs a specific test file


    npx playwright test  MyTest1.spec.js  MyTest2.spec.js   runs the files specified


    npx playwright test -g "test title"     runs test with the title


    npx playwright test --project=chromium      runs on specific browser


    npx playwright test --headed        runs tests in headed mode


    npx playwright test --debug         debug tests


    npx playwright test example.spec.js --debug           debug specific test file



  • Locating Web Elements - XPath & CSS45:56

    Locating Elements in Playwright

    ---------------------------------

    property

    css

    xpath



    Locate single element

    -----


    link/button

    ------

    await page.locator('locator').click()

    await page.click('locator');


    inputbox

    -----

    await page.locator('locator').fill('value')

    await page.locator('locator').type('value')


    await page.fill('locator', 'value')

    await page.type('locator', 'value')



    Locate multiple web elements

    ------------


    const elements=await page.$$(locator)









  • Locating Web Elements - Built-in locators in Playwright27:24
  • Playwright Test Generator (Generate Tests with Codegen tool)22:53
  • Assertions in Playwright41:08
  • Hard & Soft Assertions in Playwright13:33

Requirements

  • Anyone wanting to learn browser automation, no matter which skill level. All necessary knowledge will be taught in the course.

Description

Course  Mastering Web & API Automation with Playwright

Course Description: Playwright has emerged as a powerful tool in the realm of web automation, offering a comprehensive solution for testing and interacting with web applications across various browsers. This course is designed for professionals and enthusiasts eager to leverage Playwright's capabilities for efficient and robust web automation. With a focus on practical application, participants will gain hands-on experience in creating, running, and optimizing tests using Playwright.

Course Contents:

  1. Introduction

    • Overview of Playwright and its significance in web automation.

  2. Installation

    • Step-by-step guide on installing and setting up Playwright for different programming languages.

  3. How to create & Run tests in Playwright

    • Creating a basic test script and executing it in different browsers.

  4. Locators - XPath, CSS, Property

    • In-depth exploration of various locators and their usage in Playwright.

  5. Built-in Locators

    • Understanding Playwright's built-in locators for efficient element identification.

  6. Record and Play scripts - Test Generator

    • Utilizing the test generator to automate script creation for accelerated workflow.

  7. Assertions

    • Introduction to assertions for validating expected outcomes.

  8. Hard vs soft assertions

    • Differentiating between hard and soft assertions and their suitable applications.

  9. Handle Web Elements

    • Practical guidance on interacting with input boxes, radio buttons, checkboxes, and dropdowns.

  10. Handling multi-select dropdown

    • Techniques for handling multi-select dropdowns in web applications.

  11. Handling bootstrap drop-down

    • Strategies for dealing with Bootstrap dropdown menus.

  12. Handling Auto-suggest dropdown

    • Implementing automation for auto-suggest dropdowns.

  13. Handling hidden dropdown

    • Techniques to interact with hidden dropdowns in web pages.

  14. Handling Dialogs/Alerts

    • Managing pop-up dialogs and alerts during automation.

  15. Handle Multiple windows

    • Strategies for automating scenarios involving multiple browser windows.

  16. Handling frames

    • Techniques for working with frames within web pages.

  17. Handling inner frames

    • In-depth exploration of handling nested frames.

  18. Handling web table

    • Strategies for interacting with and validating data in web tables.

  19. Handling date pickers

    • Techniques for handling date pickers in web applications.

  20. Handling mouse actions

    • Performing mouse actions such as hover, right-click, double-click, and drag-and-drop.

  21. Keyboard actions

    • Automating interactions using keyboard actions.

  22. Upload files

    • Strategies for automating file uploads in web applications.

  23. Playwright hooks

    • Leveraging Playwright hooks for advanced automation scenarios.

  24. Grouping tests

    • Organizing and executing tests in logical groups.

  25. Capture screenshots

    • Implementing screenshot capture for test result documentation.

  26. Recording videos

    • Recording test execution for comprehensive analysis.

  27. Tracing tests with trace viewer

    • Utilizing trace viewer for in-depth test analysis.

  28. Tagging tests

    • Implementing test tagging for better organization and filtering.

  29. Annotations

    • Adding annotations for improved test documentation.

  30. Page Object Model

    • Introduction to the Page Object Model for scalable and maintainable test automation.

  31. Reporters

    • Exploring different reporting options for test results.

  32. Allure reports

    • Generating and interpreting reports using Allure.

  33. API testing with Playwright

    • Extending Playwright for API testing.

JavaScript Fundamentals(Bonus Lectures)


Join us in this comprehensive journey to master web automation with Playwright and stay ahead in the ever-evolving landscape of software testing.

Who this course is for:

  • Anyone wanting to learn browser automation, no matter which skill level. All necessary knowledge will be taught in the course