PlaywrightJS Tutorial

PlaywrightJS Tutorial

  • Docs

›The Playwright Library

Setup

  • PlaywrightJS Installation
  • Install Mocha and Chai
  • Installation Test

First Steps

  • Create a PlaywrightJS Test
  • Using Mocha and Chai

The Playwright Library

  • The Browser Object
  • The Context Object
  • The Page Object
  • Selectors
  • Navigation
  • Interactions
  • Auditing

Using PlayWright on web pages

  • A real world case

Code Generation

  • Code Generation

Cookbook

  • Timers
  • Using SQL
  • Database Connection
  • Email Setup

Auditing

Videos

Playwright can record videos for all pages inside a Browser context, and they're saved once the browser context is closed.

Examples

const context = await browser.newContext({
  recordVideo: {
    dir: 'videos/', 
    size: { width: 800, height: 600 },
  }
});
const context = await browser.newPage({
  recordVideo: {
    dir: 'videos/', 
    size: { width: 800, height: 600 },
  }
});

Screeshots

Playwright can also take screenshots in any part of the code process.

Save screenshot

await page.screenshot({ path: 'capture.png' });

Save entire page

await page.screenshot({ path: 'capture.png', fullPage: true });

Save only an element

const elementHandle = await page.$('.container');
await elementHandle.screenshot({ path: 'capture.png' });
← InteractionsA real world case →
  • Videos
    • Examples
  • Screeshots