PlaywrightJS Tutorial

PlaywrightJS Tutorial

  • Docs

›Setup

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

Installation Test

Installation Test

Create and save test.js in an editor with the following code:

const {webkit} = require('playwright');

(async () => {
   const browser = await webkit.launch();
   const page = await browser.newPage();
   await page.goto('http://whatsmyuseragent.org/');
   await page.screenshot({ path: `example.png` });
   await browser.close();
})();

Execute the test file:

playwright_test > node test.js

Once the test is executed, you should see and example.png file on the playwright_test directory, with a screenshot from the http://whatsmyuseragent.org/ web page.

← Install Mocha and ChaiCreate a PlaywrightJS Test →
  • Installation Test