Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Playwright’s browser library to visit each prepared search-results URL and save a screenshot with a predictable filename. The script below processes a keyword list sequentially, records capture details in a CSV, and lets you choose viewport or full-page images. You must supply the search URLs yourself: Playwright’s documentation does not establish a search provider’s URL format or rules for automated requests.

Build a repeatable keyword-list capture

This Node.js example uses Playwright’s Chromium browser. It creates one browser context, opens one page, and visits each URL in order. Before running it, create a folder named serp-captures, save the script as capture-serps.mjs, and prepare a UTF-8 file named keywords.json containing an array of objects with a keyword and its target URL.

[{"keyword":"example keyword","url":"https://www.google.com/search?q=example+keyword"},{"keyword":"another term","url":"https://www.google.com/search?q=another+term"}]

The example URLs illustrate input shape only. Search URL formats and permission to automate requests depend on the provider; consult its current terms and seek legal advice for your circumstances where appropriate.

Install Playwright and its browser

  1. Install a current Node.js release, then run npm init -y in your project directory.
  2. Install Playwright with npm install playwright.
  3. Install the Chromium browser binary with npx playwright install chromium.
  4. Create keywords.json with your prepared keyword and URL pairs.

Save and run this script

import { chromium } from 'playwright';
import { mkdir, readFile, writeFile } from 'node:fs/promises';
import path from 'node:path';

const inputFile = 'keywords.json';
const outputDir = 'serp-captures';
const viewport = { width: 1365, height: 900 };
const locale = 'en-US';
const fullPage = false;

function safeName(value) {
  const cleaned = value
    .normalize('NFKD')
    .replace(/[^p{L}p{N}._-]+/gu, '-')
    .replace(/^-+|-+$/g, '')
    .slice(0, 100);
  return cleaned || 'keyword';
}

const items = JSON.parse(await readFile(inputFile, 'utf8'));
if (!Array.isArray(items)) throw new Error(`${inputFile} must contain a JSON array`);
await mkdir(outputDir, { recursive: true });

const browser = await chromium.launch({ headless: true });
const context = await browser.newContext({ viewport, locale, deviceScaleFactor: 1 });
const page = await context.newPage();
const metadata = ['keyword,url,capturedAt,browser,viewport,locale,deviceScaleFactor,file'];
const usedNames = new Map();

try {
  for (const [index, item] of items.entries()) {
    if (typeof item?.keyword !== 'string' || typeof item?.url !== 'string') {
      throw new Error(`Item ${index + 1} needs string keyword and url fields`);
    }
    const target = new URL(item.url);
    if (!['http:', 'https:'].includes(target.protocol)) {
      throw new Error(`Item ${index + 1} URL must use http or https`);
    }

    const stem = safeName(item.keyword);
    const count = (usedNames.get(stem) ?? 0) + 1;
    usedNames.set(stem, count);
    const file = `${String(index + 1).padStart(3, '0')}-${stem}${count > 1 ? `-${count}` : ''}.png`;
    const filePath = path.join(outputDir, file);

    try {
      await page.goto(target.href, { waitUntil: 'domcontentloaded', timeout: 45000 });
      await page.screenshot({ path: filePath, fullPage });
      const capturedAt = new Date().toISOString();
      const csv = [item.keyword, target.href, capturedAt, `Chromium ${browser.version()}`,
        `${viewport.width}x${viewport.height}`, locale, '1', file]
        .map(value => `"${String(value).replaceAll('"', '""')}"`).join(',');
      metadata.push(csv);
      console.log(`Saved ${file}`);
    } catch (error) {
      console.error(`Failed for ${item.keyword} (${target.href}): ${error.message}`);
    }
  }
} finally {
  await writeFile(path.join(outputDir, 'metadata.csv'), `${metadata.join('n')}n`);
  await context.close();
  await browser.close();
}

Run it with node capture-serps.mjs. Successful images and metadata.csv appear in serp-captures. The numbered filenames remain distinct even when keywords repeat or sanitize to the same text. The CSV records the original keyword, final URL, capture time, browser version, viewport, locale, device scale factor, and filename so later reviewers can interpret each image.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
HP OmniBook 3 17.3 inch Laptop PC, FHD Display, AMD Ryzen 3 30, 8 GB RAM, 512 GB SSD, AMD Radeon 610M Graphics, Windows 11 Home, Mica Silver, 17-dp0199nr
  • FULL HD IPS DISPLAY - Enjoy vibrant, crystal-clear images with 178-degree wide-viewing angles
  • AMD RYZEN 3 30 PROCESSOR - Everyday performance you can count on; Multitask, stream, game casually, and edit photos smoothly with responsive power and vibrant HDR visuals
  • ENJOY UP TO 14 HOURS AND 15 MINUTES OF BATTERY LIFE - HP Fast Charge restores battery from 0 to 50% in approximately 45 minutes
  • AMD RADEON 610M GRAPHICS - Experience smooth entertainment; Built for streaming and multitasking, enjoy realistic visuals and efficient performance for work and play
  • STORAGE AND MEMORY - 512 GB PCIe NVMe M.2 SSD offers fast speed and efficient storage; and 8 GB LPDDR5 RAM memory boosts performance with higher bandwidth

The example waits for the DOM content event rather than every network request. Search pages may keep analytics or other requests open, so waiting for network idle can stall or add unnecessary delay. If key results render later, add a provider-appropriate locator wait or a short explicit delay before the screenshot; do not assume that one wait condition fits every page.

Choose what the screenshot should include

Viewport capture for the initial view

By default, page.screenshot({ path }) captures the visible viewport. This is usually suitable when you want to preserve what appears on screen without scrolling. Keep viewport dimensions and device scale factor fixed if you plan to compare captures.

Full-page capture for below-the-fold results

Set fullPage = true in the script to capture the full scrollable page. The resulting image may be much taller than the viewport and can be harder to inspect side by side. Use this when lower results or page layout matter, not simply because the option is available.

Capture only a results element

If a stable selector identifies the results region, replace the page screenshot call with a locator screenshot:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
HP 14" HD Chromebook Laptop for Students, Intel Quad-Core N4120(> N4020), 4GB RAM, 64GB eMMC, WiFi, Webcam, HDMI, USB-A&C, 14 Hours Battery Life, Zoom, Chrome OS, CUE Accessories
  • Intel Celeron N4120: 4 Cores & Threads, 1.1GHz Base Clock, Up to 2.6GHz Boost Clock, 4MB Cache, Intel UHD Graphics 600. The perfect combination of performance, power consumption, and value helps your device handle multitasking smoothly and reliably with four processing cores to divide up the work.
  • 14" HD Display: 14.0-inch diagonal, HD (1366 x 768), micro-edge, anti-glare. See your digital world in a whole new way. Enjoy movies and photos with the great image quality and high-definition detail of 1 million pixels.
  • Memory & Storage: 4 GB LPDDR4x & 64 GB eMMC Storage. Adequate high-bandwidth RAM to smoothly run multiple applications and browser tabs all at once. An embedded multimedia card provides reliable flash-based storage.
  • Ports:2 x USB 3.0 Type-A,1 x USB 3.0 Type-C,1 x HDMI,1 x Headphone Jack
  • Chrome OS: Chromebook is a computer for the way the modern world works, with thousands of apps. Enjoy the seamless simplicity that comes with Google Chrome and Android apps, all integrated into one laptop. It’s fast, simple, and secure.
await page.locator('YOUR_RESULTS_SELECTOR').screenshot({ path: filePath });

Replace YOUR_RESULTS_SELECTOR with a selector verified for the target page. Selectors can change and may differ by provider or page variant; a failed locator should be treated as a capture failure rather than silently producing an unrelated image.

Return image bytes instead of writing a file

Omit path to receive screenshot bytes for processing or storage elsewhere:

const imageBytes = await page.screenshot({ fullPage: false });

The buffer can be passed to downstream code; the script’s file and CSV handling would need to be adapted if no local image is saved.

Control browser state for meaningful comparisons

A screenshot is a snapshot under the conditions of that browser session, not proof that every searcher sees the same results. Locale, browser state, time, device emulation, provider behavior, browser version, operating system, rendering settings, hardware, power source, and headless mode can affect the rendered image. Playwright supports context-level emulation and isolated contexts; keep those settings consistent and record the ones that matter to your comparison.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
AKCHART 15.6'' AI Laptop with Office 365 12GB RAM 256GB SSD Win 11 Laptops
  • Stunning 15.6" FHD IPS Display: Experience crisp 1920x1080 resolution on this 15.6 inch laptop with an IPS panel that delivers wide viewing angles and vivid colors. The narrow-bezel design maximizes screen real estate for comfortable viewing on this Win 11 laptop, whether you're studying or working.
  • Celeron J4105 Processor & 256GB SSD: Powered by a reliable Celeron J4105 processor paired with 12GB DDR4 memory and a fast 256GB M.2 SSD. This laptop computer supports SSD expansion up to 2TB and TF card expansion up to 1TB, so your storage grows with your needs. Delivers smooth multitasking for daily productivity.
  • AI-Powered Win 11 Laptop: Built-in AI features enhance your productivity with smart assistance for writing, summarizing, and task management. Pre-installed with Win 11 and includes Office 365 subscription. This student laptop is backed by 1-year warranty and 24/7 customer support.
  • All-Day 7000mAh Battery & 180° Hinge: The high-capacity 7000mAh battery keeps this laptop powered through long classes or meetings. The 180-degree lay-flat hinge lets you share your screen effortlessly during presentations. This durable laptop computer adapts to your dynamic workflow.
  • Versatile Connectivity Hub: Equipped with USB 3.2, Type-C, Mini HDMI, and 3.5mm audio jack to connect all your peripherals. Stay online anywhere with high-speed 5G WiFi and Bluetooth 4.2. This college laptop keeps you connected at home, in the library, or on the go.
  • Viewport and scale: Fix viewport and deviceScaleFactor; changing either can affect layout or image dimensions.
  • Locale and device: Set context options deliberately when regional or device presentation matters. The example sets locale and scale; it does not emulate a mobile device.
  • Browser and environment: Keep the Playwright/browser version and machine environment consistent for visual comparisons. Record version details with the capture set.
  • Cookies and local storage: Pages in one context share that context’s browser state. Use a separate context when captures need isolated storage, such as a clean session per capture.
  • Time and personalization: Record capture time and avoid claiming that a capture is universally representative.

For visual regression testing rather than collecting reviewable snapshots, Playwright Test provides toHaveScreenshot() baselines and comparisons. Those comparisons are also sensitive to environment differences.

Choose sequential pages, parallel pages, or separate contexts

One page, sequentially

The supplied script reuses one page and navigates to each URL in turn. This is the simplest approach to debug and produces an easy-to-follow ordering. It also reuses browser state between navigations, so site cookies or other storage may influence later captures.

Multiple pages in one context

A browser context can contain several pages, each of which can navigate independently. That can increase throughput, but there is no universal concurrency level for search-results collection. Keep any concurrency bounded, apply appropriate waits, and verify the provider’s current rules before increasing request volume.

Separate contexts for isolated state

Separate contexts isolate browser storage such as cookies and local storage, and can have their own context-level emulation settings. Use them when each capture must start independently; opening a new page in the same context does not provide that storage isolation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
HP Essential Laptop 2026, Intel CPU, 128GB Storage, Office 365, Windows 11
  • Efficient Performance for Everyday Computing: Powered by Intel N150 processor with up to 3.6 GHz Intel Turbo Boost Technology, 6 MB L3 cache, 4 cores, and 4 threads, this HP laptop delivers responsive performance for web browsing, streaming, document editing, and multitasking. Paired with 4GB LPDDR5 RAM and 128GB UFS storage, it handles daily tasks smoothly. Includes 1-year Microsoft 365 Personal subscription for Word, Excel, PowerPoint, and cloud storage to maximize your productivity.
  • 14-Inch HD Micro-Edge Display:Enjoy clear visuals on the 14-inch HD (1366 x 768) anti-glare screen with 250-nit brightness and 62.5% sRGB coverage. The micro-edge bezel delivers a 79% screen-to-body ratio in a compact design. An HP True Vision 720p HD camera with noise reduction and dual-array microphones supports clear video calls, remote work, and online learning.
  • Modern Connectivity and Wireless Technology: Stay connected with Wi-Fi 6 (2x2) for faster wireless speeds and Bluetooth 5.4 for seamless pairing with accessories. Versatile port selection includes 1 USB Type-C 10Gbps with DisplayPort 1.2 for external displays, 2 USB Type-A 5Gbps ports for peripherals, 1 HDMI 1.4b port, 1 headphone/microphone combo jack, and 1 multi-format SD media card reader. Connect monitors, transfer files quickly, and expand your workspace with ease.
  • All-Day Battery Life and Portable Design: Enjoy up to 11 hours of video playback, 7.5 hours of mixed usage, or 7.5 hours of wireless streaming on a single charge, perfect for students and professionals on the go. Weighing just 3.24 lb and measuring 12.76" x 8.86" x 0.71", this lightweight laptop fits easily in backpacks and bags. The stylish willow green top cover with matte finish and natural silver keyboard deck with vertical brushing pattern offer a modern, professional look.
  • AI-Enhanced Productivity: Access Microsoft Copilot instantly with the dedicated Copilot key for faster assistance. AI Noise Reduction filters background sounds and improves voice clarity during calls. Dual speakers provide clear audio, while the full-size natural silver keyboard and HP Imagepad support comfortable typing and navigation.

CLI or library API?

The Playwright CLI screenshot command is useful for interactive one-off captures and documents custom filenames, PNG/JPEG/WebP output, viewport or element capture, full-page mode, and high-resolution capture. For looping over a keyword list, the library API is the more direct building block: the script can validate each URL, navigate, name outputs, log failures, and record metadata in one workflow. The CLI screenshot reference does not describe a dedicated keyword-list batch command.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common capture failures

  • Browser executable is missing: Run npx playwright install chromium for the browser used by the script.
  • Invalid JSON or missing fields: Check that keywords.json is a JSON array and every item has string-valued keyword and url properties.
  • URL parse error or unsupported protocol: Provide an absolute URL beginning with http:// or https://; the script rejects other protocols.
  • Navigation timeout: A slow page or long-running request may exceed the 45-second navigation timeout. Check the URL and connectivity, then choose a timeout suitable for your workflow. A timeout is logged and processing continues to the next item.
  • Screenshot is blank or incomplete: The page may not have rendered its results by domcontentloaded. Add a verified locator wait or a short delay; a delay improves timing consistency only when adequate and does not guarantee identical page content.
  • Element screenshot fails: Confirm the selector exists and is visible after navigation, and account for page variants before relying on it.
  • Duplicate or awkward filenames: The script sanitizes keyword text and prefixes each output with its input order; duplicate sanitized names receive an additional counter.
  • Images differ between runs: Compare browser version, operating system, viewport, device scale, locale, context state, and headless/environment settings before attributing differences to the search page.

Performance, reliability, and collection boundaries

Sequential navigation minimizes complexity but takes longer as the list grows. Multiple pages may improve throughput, at the cost of higher resource use and more complicated failure handling. Start sequentially, measure your own workload, and only add bounded parallelism if it is useful and consistent with the search provider’s rules. The Playwright documentation does not set a safe request rate or determine whether automated queries are permitted. Check the current terms for the specific provider and get advice for your jurisdiction and use case rather than treating a successful browser run as permission.

For more resilient batch jobs, consider writing each successful capture’s metadata immediately rather than only at the end, and retaining failed keyword/URL pairs in a separate log. The example writes metadata on exit, including after individual item failures, but a process interruption before cleanup can leave the CSV incomplete.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server for developers. One GET request returns an image or PDF, with the other capture options documented at ScreenshotNeo’s API documentation. For a URL you are authorized to capture, this cURL example saves a WebP image:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
HP 14 inch Laptop, 2027 Edition, Intel N150 CPU, 4GB RAM, 128GB SSD, Copilot AI, 1TB Cloud Storage, Long Battery Life, Win 11 with Microsoft 365
  • 【Expansive Display】The 14 Non-touch display offers clear, and anti-glare coating, perfect for both work and entertainment.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Cookie/consent banners are accepted like a visitor and more than 60 known consent platforms, newsletter popups, and chat widgets can be removed before capture; each step can be turned off. Bot checks/CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers identify the page verdict and billing status. Its MCP server offers take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000.

Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month with no card.

Frequently Asked Questions

Can I use Playwright to prove what every searcher saw?

No. A screenshot records one browser session under its specific conditions; it is not universal evidence of every user’s results.

Does Playwright provide a built-in keyword-list SERP command?

The CLI screenshot reference does not document a dedicated keyword-list batch command. A script using the library API can loop through prepared URLs.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.