• 04 Jan 2024
  • 2 Minutes to read
  • Dark


  • Dark

Article summary


Playwright stands as a Node.js library, leveraging a JavaScript runtime to simplify the process of web development. This versatile tool serves as a cross-browser framework, offering a unified API for seamless end-to-end automated testing of web applications. By employing Playwright, developers can conduct regular tests to ensure the smooth and expected performance of their web applications. What sets Playwright apart is its ability to simulate real-world events from a user's perspective, providing a comprehensive testing environment that closely mirrors user interactions.

In essence, Playwright plays a crucial role in enhancing the efficiency and reliability of web development testing. Its integration with Node.js and JavaScript not only facilitates a developer-friendly environment but also ensures a consistent testing approach across different browsers. With its focus on emulating user experiences, Playwright goes beyond traditional testing methods, offering a robust solution for developers to validate the functionality and performance of their web applications.

Playwright Execution guide with pCloudy


  • A pCloudy account is a prerequisite.
  • Node must be installed in the client machine, and its version should be greater than 12.
  • NPM should also be there
  • Ensure compatibility with playwright version 1.39.0, as it is the supported version for the framework.


  • Inside an Empty folder initiate a blank NodeJS project by the following command

    npm init –y
  • Then Install the following dependencies by the following command

    npm install playwright@1.39.0
  • Now create a new js file which should contain the below script name the file as playwrightDemo.js

    const { chromium } = require('playwright');
    (async () => {
    const capabilities = {
    'browserName': 'chrome', // Browsers allowed: 'chrome', 'edge'
    'pc:options': {
    'email': 'Enter-Email',
    'apiKey': 'Enter-api-Key',
    'clientName': 'Enter-client-Name',
    const browser = await chromium.connect({
    headless: false,
    wsEndpoint: `wss://${encodeURIComponent(JSON.stringify(capabilities))}`, // change the value of base url accordingly
    const context = await browser.newContext();
    const page = await context.newPage();
    await page.goto('');
    await page.locator('#userId').type('');
    await page.locator('#password').type('');
    await page.locator('#loginSubmitBtn').click();
    await page.close();
    await browser.close();
  • To get the “instance_id” for the script run the following api to fetch the details

    1. Fetch token
      Method : POST
      Url -

      Body : {"clientName":"Enter-client- Name","apiKey":"Enter-apikey"}
    2. Get Instance Id

      Method : POST

      Url -

          Body : {"browserCloudAuthToken": "Enter-the-token-fetched-from-above"}

      From the above you will get multiple instance id for different OS replace the incance_id value with that which you want to use

      Note - change the value of base url accordingly


To execute run the following command inside the project folder

Node playwrightDemo.js

Was this article helpful?

What's Next