ScreenshotNeo

BlogHow-to

How to Install Playwright for Website Screenshots on Windows in India

Install Playwright on Windows, choose the right package, download a browser, and save a website screenshot. Proxy and download fixes are included.

By the ScreenshotNeo team4 October 20267 min read

To take a website screenshot with Playwright on Windows, install the Playwright Library in a Node.js project, download its Chromium browser binary, run a short JavaScript script, and save the image. The setup commands are the same in India as elsewhere; use proxy or certificate settings only if your network blocks the browser download.

1. Check Windows and Node.js requirements

The current Playwright Test installation guide lists Node.js 22.x, 24.x, or 26.x and Windows 11 or later, Windows Server 2019 or later, or WSL. Requirements can change, so check the current Playwright requirements before installing. These are official supported versions, not India-specific requirements.

Install Node.js if it is not already available, then open PowerShell and check your version:

node --version
npm --version

If the Node version is outside the currently supported list, install a supported version before proceeding. Use a project folder where you have permission to create files and download browser binaries.

2. Choose the Playwright package that fits the job

Route Use it for Command
Playwright Library A direct screenshot script or custom browser automation without needing the Playwright Test runner. npm i -D playwright
Playwright Test A test project with Playwright’s test runner and project setup. npm init playwright@latest

For one script that captures a site, use the Library route. The Test starter is useful when screenshots are part of an automated test suite. The commands create or update project files, so run them from the directory where you want that project.

3. Install Playwright and its browser

For a standalone script, create a folder, initialize a Node project, install the Library, and download Chromium:

mkdir website-screenshot
cd website-screenshot
npm init -y
npm i -D playwright
npx playwright install chromium

If you started with Playwright Test instead, its setup may prompt you to install browsers. You can install only Chromium with npx playwright install chromium, or the default supported browsers with npx playwright install. Choose Chromium when that is the only browser you need; install other named browsers when your work requires cross-browser screenshots.

Playwright downloads browser binaries separately from the npm package. Each Playwright version expects specific browser versions, so after updating the package, run the browser install command again if needed. The official documentation says browser downloads take a few hundred megabytes; make sure there is enough disk space and that the connection can reach the download source.

4. Save a website screenshot

In the project directory, save this as screenshot.js. Replace the URL with the site you want to capture.

const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch();
  try {
    const page = await browser.newPage();
    await page.goto('https://example.com');
    await page.screenshot({ path: 'screenshot.png' });
  } finally {
    await browser.close();
  }
})();

Run it from PowerShell in the project directory:

node screenshot.js

The image is written to screenshot.png. Playwright infers the image type from the file extension. This example captures the current viewport. For full-page capture, set fullPage: true in the screenshot options:

await page.screenshot({ path: 'screenshot.png', fullPage: true });

Use a fixed viewport when you need repeatable dimensions, and wait for the page state your capture needs. For example:

const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });
await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
await page.screenshot({ path: 'screenshot.png', fullPage: true });

Navigation readiness and screenshot completeness are different concerns: a page can continue loading images or changing after the initial document is ready. If the page depends on client-side rendering or lazy images, wait for a relevant selector or other site-specific condition before capturing. Avoid an arbitrary long delay unless the page actually needs it.

5. Adjust browser installation and storage when needed

Install more than Chromium

Use npx playwright install to install the default supported browsers, or name the browser needed by your project, such as firefox or webkit. Different browser engines can render a page differently, so use the browser that matches the environment you need to reproduce.

Move the browser cache

On Windows, Playwright’s default browser download directory is %USERPROFILE%\AppData\Local\ms-playwright. Set PLAYWRIGHT_BROWSERS_PATH before installation to use another directory. In PowerShell, for the current session:

$env:PLAYWRIGHT_BROWSERS_PATH = 'D:\playwright-browsers'
npx playwright install chromium

Set the same variable when running the script so Playwright looks in that location. If the variable is set only during installation, a later process may search the default directory instead.

6. Troubleshoot browser downloads and screenshots

Symptom Likely cause What to do
Executable doesn't exist or browser launch reports a missing binary The browser binary was not installed, or the package and browser versions are out of sync. From the project directory, run npx playwright install chromium. After changing the Playwright package version, run the install command again.
Browser download fails or times out A proxy, firewall, network policy, or slow connection is interrupting the download. First confirm the network can access the browser download source. If your network requires a proxy, configure HTTPS_PROXY in PowerShell for the install session. If the connection is simply slow, the Playwright browser guide documents PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT.
Certificate or TLS error during download The network uses a custom certificate authority that Node.js does not trust. If your organization provides a trusted CA certificate, set NODE_EXTRA_CA_CERTS to its certificate file in PowerShell before installing. Do not disable certificate validation.
Not enough disk space Browser binaries require a few hundred megabytes, and the cache may contain more than one browser version. Free space or move the cache with PLAYWRIGHT_BROWSERS_PATH. Remove only browser files you know are unused; projects may depend on their installed versions.
Screenshot is blank or misses content The page has not rendered its content yet, needs authentication, or loads images and components later. Check the target URL and access requirements. Wait for a page-specific selector or state before capturing. For lazy-loaded content, scroll it into view or otherwise trigger the page’s loading behavior before a full-page capture.
install-deps does not install Windows dependencies npx playwright install-deps targets Linux dependency setup. On native Windows, install the browser with npx playwright install. Use Linux dependency steps only when actually running under WSL and following its setup instructions.

For a proxy-required network, set the proxy only when the download fails for that reason. Example PowerShell syntax, using the proxy address supplied by your network administrator:

$env:HTTPS_PROXY = 'http://proxy.example:8080'
npx playwright install chromium

For the documented slow-connection setting, increase the timeout in the install session as appropriate for your network:

$env:PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT = '120000'
npx playwright install chromium

For custom certificates, point Node.js at the CA file supplied by your organization:

$env:NODE_EXTRA_CA_CERTS = 'C:\certs\organization-ca.pem'
npx playwright install chromium

Proxy, custom CA, and timeout settings are conditional troubleshooting measures. India does not require a different Playwright installer or command.

7. Keep captures repeatable and affordable

  • Install only what you use. Chromium alone uses less download and storage than installing every browser engine.
  • Keep package and browser versions aligned. Reinstall browser binaries after a Playwright update if launch errors indicate a missing or incompatible executable.
  • Choose the capture size deliberately. Full-page captures can produce much taller images than viewport captures, using more memory and storage.
  • Wait for the right condition. A specific selector or application state is generally more reliable than a large fixed sleep.
  • Close the browser in cleanup code. The finally block ensures the browser process is closed even when navigation or saving fails.
  • Budget for local resources. Playwright itself is software; browser downloads need disk space, and each running browser consumes local CPU and memory. There is no India-specific installation charge in the documented setup.

Or skip the browser setup

If you need a screenshot without managing Node.js, browser binaries, and a local browser process, ScreenshotNeo is a website screenshot API and MCP server for developers. A single GET request returns an image or PDF. See the ScreenshotNeo API documentation.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server gives AI agents tools for screenshots, page information, and PDFs. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots.

Sign up for 1,000 free screenshots a month, with no card required.

FAQ

Do I need Playwright Test to take a screenshot?

No. The Playwright Library is enough for a standalone script. Use Playwright Test when you also need its test runner and project structure.

Can I use these steps on Windows 10?

The current Playwright Test requirements list Windows 11 or later, Windows Server 2019 or later, or WSL. Check the current official requirements for changes and supported configurations.

Why is there a separate browser install command?

The npm package and the browser binaries are installed separately. Playwright versions expect particular browser binaries, so install them for the version used by your project.

Does a viewport screenshot include the entire page?

No. The default screenshot is the current viewport. Set fullPage: true when you need a full-page image.

Is there a special Playwright installer for India?

No. Use the same official setup commands. Configure a proxy or trusted certificate only if your network requires it.

Official references