Next-Gen App & Browser
Testing Cloud
Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles
Read this tutorial about Playwright, the new automation testing framework, to know what it is, how to install it, and how we can execute tests using Playwright.
Published on: October 6 2022
A standard test automation framework provides an environment for carrying out test plans and producing repeatable results. There are specialized frameworks that enable you to perform routine test automation activities. One such framework is Playwright.
In this Playwright tutorial series, we will begin with the basics of Playwright, outlining its capabilities and demonstrating how to install Playwright using the VS Code plugins.
Playwright is a cross browser automation framework for end to end testing created by the Microsoft team and has been steadily gaining popularity. It is a NodeJS library to automate Chromium, Firefox, and WebKit with a single API.
WebKit is a browser engine developed by Apple and used in its Safari web browser and all iOS web browsers. Also, Playwright started as a fork of a Puppeteer. Puppeteer is a node library that automates the Chrome and Firefox browsers with the JavaScript API.
Here’s the highlights of the capabilities of Playwright:
Here are the prerequisites to setting up VS Code:
In this section of this Playwright tutorial, we will learn how to install Playwright and set up VS Code. Below are the steps to be followed:
Step 1: Create a folder with “learn-playwright” as a folder name.
Step 2: Ensure the NodeJS version is above 14 from the command prompt.
Step 3: Open the created folder and type “cmd” in the address bar. The below screen appears.
Step 4: Type “code”. to launch VS Code. You can now see the created folder as a project in VS Code.
Step 5: Navigate to the EXTENSIONS section and type "Playwright". There are multiple options available. Select the Playwright Test for VS Code by Microsoft option.
Step 6: Click Install.
Step 7: Press CTRL + SHIFT + P to open the command panel and type "install Playwright".
Step 8: Enable the Chromium, Firefox, and WebKit checkboxes, as Playwright supports all browser engines.
Step 9: Click Okay.
Step 10: Expand the Project Explorer, and the “example.spec.ts” file is displayed.
Step 11: To execute the test, click the Green arrow icon.
Step 12: To disable the Headless mode, navigate to the playwright.config.ts file.
Step 13: In the use block, type “headless: false,” and execute again to view the browser.
Playwright makes automation quick, reliable, and simple for anyone eager to acquire a new skill. An online cross browser testing platform like LambdaTest is excellent for performing Playwright testing. It gives you access to an online browser farm with more than 50+ browser versions and OS combinations, enabling you to run the Playwright scripts.
Subscribe to the LambdaTest YouTube Channel, and stay updated with the latest Playwright tutorial, Cypress UI testing, responsive testing, mobile testing, etc. We have now discussed how to install Playwright using the VS Code plugins. Stay tuned for the next video on the Playwright Tutorial Series.
Did you find this page helpful?