Install Playwright and its browsers
Introduction
Welcome! Now that you've set up Node.js, npm, and initialized your project with Git, you're ready to install Playwright and its browsers. This step is foundational for all your future browser automation work as an SDET using Playwright with TypeScript. Once Playwright is installed, you'll be able to run automated tests on real browsers right from your local machine. Let's make sure your environment is set up correctly before moving on to configuring TypeScript and other tools.
What is Playwright and Why Install Browsers?
Playwright is a powerful end-to-end testing framework that allows you to automate browsers like Chromium (Chrome/Edge), Firefox, and WebKit (Safari). Installing Playwright not only gives you the test runner and APIs, but also downloads browser binaries so your tests can run reliably across different engines—without relying on browsers already installed on your system.
Installing Playwright via npm
You’ll use npm
(Node Package Manager) to install Playwright as a development dependency in your project. This ensures everyone working on the project uses the same version.
npm install --save-dev playwright
💡 Pro Tip: Always use
--save-dev
for test tools so they’re listed asdevDependencies
inpackage.json
.
Automatic Browser Download
When you install Playwright, it automatically downloads the latest versions of Chromium, Firefox, and WebKit. This means you don't have to manually install browsers or worry about version mismatches.
💡 Pro Tip: If you want to skip browser downloads (for example, in CI), add the environment variable
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
before runningnpm install
.
Verifying Your Installation
After installation, you can verify that Playwright and its browsers are ready by running the following command:
npx playwright install
This command will check for missing browser binaries and download them if needed. It’s useful if you ever need to re-download browsers or set up a new environment.
Personalized Learning Experience
Most tutorials treat everyone the same. OpenLume adapts to your skills, pace, and goals.
Access tailored content, assessments, and mock interviews — all in one place.