Cross browser automation testing using Nodejs

Selenium is most popular tool to write automation tests as of now. Selenium uses webdriver which can have few bugs and does not have vast control of browser like Nodejs tools. So Puppeteer and playwright are getting famous to automate end to end testing. Playwright and Puppeteer and mostly similar, main difference is playwright support muliple browsers while puppeteer suppors only chromium based.

Table of Contents #

  1. Setup
  2. Selectors
  3. Interactions
  4. Design Techniques

Setup #

Node installation #

To start with the setup make sure you have nodejs installed on your system, Do this by running following commands.

$ node -v
v14.17.0

$ npm -v
6.14.13

If these commands are not available install nodejs from https://nodejs.org/.

Create a new project #

Create a new directory, goto that newly created directory


mkdir mytests
cd mytests
npm init -y
npm i -D playwright

Example2 #

Third Example #

Fourth Example #


Since you've made it this far, sharing this article on your favorite social media network would be highly appreciated ! For feedback, please ping me on Twitter.

Published