Playwright JS

Introduction

JavaScript is the native language for Playwright, so knowing it you can write the most powerful tests.

Installation

For installing Playwright in NodeJS read here

Banner image

Example

A simple example that just opens and closes a page. It is needed to check that the setup works.

const playwright = require('playwright') async function run() { try { const browser = await playwright["chromium"].launch({ // headless: false headless: true }); const context = await browser.newContext(); const page = await context.newPage(); await page.goto("https://www.aredel.com/ui/basic/"); await browser.close(); } catch (error) { console.error(error); } } run();

Article author: Andrei Olegovich

Banner image