Install Playwright and its browser binaries, open the page with a Playwright Page, then call page.screenshot(). Use full_page=True for the full scrollable document, or take a screenshot from a locator to capture one element.
Install Playwright and a browser
Playwright’s Python package and its managed browser binaries are installed separately. In PowerShell, run:
python -m pip install --upgrade pip
python -m pip install playwright
python -m playwright install
The last command installs the browser revisions Playwright needs. The shorter playwright install command is also documented; use python -m playwright install if PowerShell cannot find the playwright command. See the Playwright Python library guide for installation and usage.
The documented installation requirements list Python 3.8 or higher and Windows 11 or later, Windows Server 2019 or later, or WSL. Requirements can change, so check the current installation page if you use an older Windows release.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
#1 Best Overall
- Spacious Design: Measuring 21.1" wide and 14.1" deep, our lap desk comfortably fits most laptops up to 15.6". Extra room for accessories ensures convenience.
- Enhanced Functionality: Packed with handy features, including a 5x9" precision tracking mouse pad and a built-in phone slot for seamless work or video calls. Plus, enjoy ergonomic support with the integrated cushioned wrist rest.
- Cool Comfort: Enjoy a stable surface with our lap desk's dual bolster cushion, designed for comfort and airflow, keeping your lap cool during extended use.
- Durable Surface: Work with confidence on our lap desk's solid surface, featuring a sleek black carbon color, ensuring optimal air circulation to prevent your laptop from overheating.
- On-the-Go Convenience: With an integrated handle and lightweight design (2.8 lbs), our lap desk is portable for travel or moving around the house, offering flexibility in any space.
Capture a website with synchronous Python
Save this as capture.py, replacing the example URL and output path as needed:
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
page.goto("https://example.com")
page.screenshot(path="screenshot.png")
browser.close()
Run it from PowerShell with python capture.py. The screenshot path is relative to the process’s current working directory. To save to a known Windows folder, use a raw string such as r"C:UsersYourNamePicturessite.png". The example launches Chromium; Playwright also supports Firefox and WebKit when you have installed the corresponding browser binaries.
Choose what to capture
Visible viewport
The basic page.screenshot(path="screenshot.png") captures the currently visible viewport. Set the page viewport before navigation if you need a particular browser-window size.
Rank #2
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Entire scrollable page
Set full_page=True to capture the whole scrollable document as a single tall image:
page.screenshot(path="full.png", full_page=True)
Full-page capture can create large images on long pages. If you need only a defined region, use the screenshot API’s clip option instead of capturing the entire document. See Playwright’s screenshot guide for examples and supported screenshot options.
One element
Use a locator to capture a specific element, such as a header or a product card:
Rank #3
- Note: Not suitable for MacBooks released after 2023 or devices with a protruding front camera; Not applicable to full-screen or notch-style tempered glass screen protectors; Do not use on the rear camera of the phone.
- 💻 Why Do You Need a Webcam Cover Slide? — Safeguard your privacy by covering your webcam with our reliable webcam cover when not in use. Don't let anyone secretly watch you. Stay protected!
- ✅ Thin & Stylish — Enhance your laptop's functionality and aesthetics with our 0.027" ultra-thin webcam covers. Seamlessly close your laptop while adding a touch of sophistication.
- ✅ Fits Most Devices — Compatible with laptops, phones, tablets, desktops! Keep your privacy intact on Ap/ple, Mac/Book, iPh/one, iP/ad, H/P, L/novo, De/ll, Ac/er, As/us, Sa/msung devices.
- ✅ 365 Days Protection — Our upgraded 3.0 adhesive ensures a strong hold that won't damage your equipment. Experience reliable, long-term privacy protection day in and day out.
page.locator(".header").screenshot(path="header.png")
Locator screenshots are preferable to the discouraged ElementHandle screenshot API. To reduce animation-related differences in a capture, pass animations="disabled". Locator screenshots also support scale="css" (one output pixel per CSS pixel) and scale="device" (one output pixel per device pixel). Details are in the Locator API.
Keep the image in memory
Omit path when you want the screenshot bytes for image processing or comparison rather than a file:
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →image_bytes = page.screenshot()
The screenshot guide covers the returned buffer and other options such as image format and quality.
Rank #4
- Anti-Slip Surface - Transform your laptop into a mobile workstation with the AboveTEK portable laptop lap desk. The anti-slip surface provides a strong grip for laptops up to 15.6 inches(Diagonal), while the double rubber strip on the bottom ensures a stable display or typing experience on your lap, couch, or bed.
- Retractable Mouse Pad - Retractable laptop mouse pad extends on both directions for the left/right handed with elevation along the edges for stopping mouse from falling off. The size of laptop tray is 14" X 9.7" and the size of mouse pad is 7.4" X 6.1".
- Effective Heat Shield - The effective heat shield made of sturdy and thick material protects your laptop from overheating. Prioritizes your comfort and safety, an ideal lap pad or board for working anywhere.
- EASY to Carry and Store - With an ergonomic and simplistic design, the lap desk is portable to store in a backpack. Only 15" in size, 2.2 lb of weight and with slim 0.6 inch thickness, it is ready to be easily carried around.
- Widely Applicable - The smooth platform accommodates laptops and tablets up to 15.6 inches(Diagonal), making it a versatile accessory and one of the best gifts for mom, dad, students and professionals. Perfect for use as a laptop bed tray or tablet holder anywhere at home, library, or park.
Use async Python when the surrounding application needs it
The synchronous example is the simplest standalone script. In an asynchronous application, use async_playwright and await browser and page operations:
import asyncio
from playwright.async_api import async_playwright
async def main():
async with async_playwright() as p:
browser = await p.chromium.launch()
page = await browser.new_page()
await page.goto("https://example.com")
await page.screenshot(path="screenshot.png")
await browser.close()
asyncio.run(main())
On Windows, Playwright’s async driver requires a ProactorEventLoop. Python 3.8 and later use it by default; if a framework or older customized environment replaced the loop, restore the Proactor loop as described in the library guide.
Browser choices, updates, and Windows storage
Chromium is a practical default for a basic capture script. Use Firefox or WebKit when your task requires those browser engines. If Microsoft Edge is installed, launch it through the Chromium API with p.chromium.launch(channel="msedge").
Best Value
- Spacious Design: Measuring 21.1" wide and 12" deep, our lap desk comfortably fits most laptops up to 15.6". Extra room for accessories ensures convenience.
- Enhanced Functionality: Packed with handy features, including a 5x9" precision tracking mouse pad and a built-in phone slot for seamless work or video calls. Plus, enjoy laptop support with the integrated device ledge.
- Cool Comfort: Enjoy a stable surface with our lap desk's dual bolster cushion, designed for comfort and airflow, keeping your lap cool during extended use.
- Durable Surface: Work with confidence on our lap desk's solid surface, featuring a blush pink color, ensuring optimal air circulation to prevent your laptop from overheating.
- On-the-Go Convenience: With an integrated handle and lightweight design (2.14 lbs), our lap desk is portable for travel or moving around the house, offering flexibility in any space.
Playwright browser revisions track package releases: “Each version of Playwright needs specific versions of browser binaries to operate.” If an update leaves the required browser missing, run python -m playwright install using the same Python environment that runs the script. On Windows, the default browser cache is %USERPROFILE%AppDataLocalms-playwright. See the official browser documentation.
Troubleshoot common capture problems
- Browser executable missing: Install the browser binaries with
python -m playwright installfrom the environment where Playwright is installed. The Python package alone is not enough. - PowerShell says
playwrightis not recognized: Runpython -m playwright installinstead, or verify that the command-line script installed by pip is on PATH. - Screenshot saved in an unexpected folder: A relative
pathis resolved from the process working directory, which may differ from the directory containing the script. Use an absolute Windows path, written as a raw string or with escaped backslashes. - Only the visible part of the page was captured: Use
full_page=Truefor the full scrollable document. For a single component, usepage.locator("selector").screenshot(...). - Element capture looks inconsistent because of animation: Use
animations="disabled"in the locator screenshot call. - Async subprocess or event-loop error on Windows: Check whether your application replaced the ProactorEventLoop required by Playwright’s async driver; modern supported Python versions use it by default.
- Browser fails after a Playwright package update: Install the matching browser binaries again with the CLI. Browser versions must be compatible with the installed Playwright version.
Or skip the browser setup
ScreenshotNeo offers a screenshot API, so a request can return an image without installing Playwright or managing browser binaries. One cURL request:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
See the ScreenshotNeo API documentation for authentication and request options. Cookie banners, popups, and chat widgets are removed before the shot; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots, and 1,000 screenshots per month are free with no card; paid plans start at $5 for 3,000. Learn about ScreenshotNeo, or sign up for 1,000 free screenshots a month with no card.
Frequently Asked Questions
Can I use Microsoft Edge instead of Chromium?
Yes. If Edge is installed, launch it with p.chromium.launch(channel="msedge").
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Can I take a screenshot without writing it to a file?
Yes. Omit the path argument; page.screenshot() returns image bytes.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

