DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
FREEDOM251

Freedom251 › Blog › browser automation

How to Screenshot a Batch of URLs and Upload Them to Google Drive

By Freedom251 Team · · 7 min read

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

Use Playwright to visit each URL, save a uniquely named screenshot, then upload those files to Google Drive. For a repeatable workflow, keep capture and upload as separate steps: capture failures can be logged per URL, while Drive uploads can be retried independently. Google Drive API batch requests do not combine screenshot media uploads into one request.

Choose what each screenshot should show

Playwright can capture the visible viewport or the full scrollable page. A viewport screenshot records what is visible without scrolling; a full-page screenshot creates a taller image that includes the page’s scrollable content. Use the option that matches the record you need, since full-page images can be much larger and may not represent a single screen view.

As an Amazon Associate I earn from qualifying purchases.

The Playwright screenshot API supports saving directly to a file with page.screenshot({ path: 'screenshot.png' }), setting fullPage: true, or returning screenshot bytes in a buffer. It does not provide a single built-in operation that accepts a list of URLs and handles the whole capture-and-upload workflow; the loop, readiness checks, file naming, and error handling belong in your script. See the Playwright screenshots documentation.

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

Capture a URL list with Playwright

The example below uses Node.js and Playwright. It reads one URL per line from urls.txt, opens each page, and saves a separate PNG in a local screenshots directory. The numeric prefix prevents two URLs with the same hostname from overwriting each other.

#1 Best Overall
Sale
Epson Workforce ES-50 Compact & Lightweight Mobile Document Scanner | For Computers including PC and Mac Receipt and Document Scanner USB Powered
  • PORTABLE SCANNER FOR USE ON-THE-GO — The fastest and lightest mobile single-sheet-fed compact document scanner in its class¹
  • QUICK DOCUMENT SCANNING ― This Epson ultra-fast scanner scans a single page as quickly as 5.5 seconds²; Windows and Mac compatible
  • VERSATILE PAPER HANDLING ― Portable scanner scans documents up to 8.5 x 72 in; Also easily digitizes receipts and ID cards to make accounting, bookkeeping, and organizing simpler
  • INTUITIVE, HIGH-SPEED SOFTWARE — Epson ScanSmart Software³ is a smart tool allowing you to easily scan, review, and save; Stay organized easily with the help of this Epson scanner
  • EASY SETUP — USB-powered connect to your computer for quick and simple scanning; No batteries or external power supply required to operate portable document scanner; Standard Connectivity: USB 2.0
  1. Install Playwright and its Chromium browser in your project using the Playwright installation instructions.

  2. Put one complete URL per line in urls.txt, for example https://example.com/. Remove blank lines or leave them; the script below skips them.

  3. Save this as capture.mjs and run node capture.mjs.

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

const urls = (await readFile('urls.txt', 'utf8'))
  .split(/r?n/)
  .map(line => line.trim())
  .filter(Boolean);

await mkdir('screenshots', { recursive: true });
const browser = await chromium.launch({ headless: true });
const results = [];

try {
  const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });

  for (const [index, url] of urls.entries()) {
    const filename = `screenshots/${String(index + 1).padStart(4, '0')}.png`;
    try {
      await page.goto(url, { waitUntil: 'load', timeout: 30000 });
      await page.screenshot({ path: filename, fullPage: true });
      results.push({ url, filename, status: 'captured' });
      console.log(`Captured ${url} -> ${filename}`);
    } catch (error) {
      results.push({ url, status: 'failed', error: String(error) });
      console.error(`Failed ${url}: ${error}`);
    }
  }
} finally {
  await browser.close();
}

console.log(JSON.stringify(results, null, 2));

To capture only the viewport, remove fullPage: true or set it to false. The script uses the load navigation state and a 30-second timeout as practical defaults, not universal readiness guarantees. Pages that render important content after load may need a site-specific wait, such as waiting for a known selector. Avoid assuming that one fixed delay works for every target.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Brother DS-640 Compact Mobile Document Scanner, (Model: DS640)
  • FAST SPEEDS - Scans color and black and white documents a blazing speed up to 16ppm (1). Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
  • ULTRA COMPACT – At less than 1 foot in length and only about 1. 5lbs in weight you can fit this device virtually anywhere (a bag, a purse, even a pocket).
  • READY WHENEVER YOU ARE – The DS-640 mobile scanner is powered via an included micro USB 3. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan.
  • WORKS YOUR WAY – Use the Brother free iPrint&Scan desktop app for scanning to multiple “Scan-to” destinations like PC, Network, cloud services, Email and OCR. (2) Supports Windows, Mac and Linux and TWAIN/WIA for PC/ICA for Mac/SANE drivers. (3)
  • OPTIMIZE IMAGES AND TEXT – Automatic color detection/adjustment, image rotation (PC only), bleed through prevention/background removal, text enhancement, color drop to enhance scans. Software suite includes document management and OCR software. (4)

Make output names useful and safe

The example uses stable sequence numbers, which are safe for arbitrary URL paths and unique within the input list. If you want filenames that identify pages, derive a label from the hostname or path, sanitize characters that are unsafe in filenames, and retain a unique index or other collision-proof suffix. Do not use the raw URL as a path: URLs can contain slashes, query strings, and characters unsuitable for filenames.

Handle partial failures deliberately

A failed navigation should not silently stop the rest of the batch. The example records each failure and continues; review the final JSON output and rerun failed URLs after addressing their cause. If a capture is important, retain the URL-to-filename mapping alongside the images so you can identify which output belongs to which input.

Upload the screenshots to Drive

Manual upload in Google Drive

For a small, occasional batch, open the destination folder in Google Drive and select the screenshot files through Drive’s upload interface. You can also automate a compatible HTML file input with Playwright’s setInputFiles(), which accepts multiple file paths in one call. That works only when the upload flow exposes an input that accepts those files; verify the actual interface rather than assuming every Drive UI flow supports scripted multi-file selection. See the Playwright file upload documentation.

Rank #3
Sale
Canon imageFORMULA R10 - Portable Document Scanner, USB Powered, Duplex Scanning, Document Feeder, Easy Setup, Convenient, Perfect for Mobile Users, White
  • STAY ORGANIZED – Easily convert your paper documents into digital formats like searchable PDF files, JPEGs, and more.Power Consumption : 2.5W or less (Energy Saving Mode: 0.7W). Suggested Daily Volume : 500 scans..Does it contain liquid: no
  • CONVENIENT AND PORTABLE –lightweight and small in size, you can take the scanner anywhere from home offices, classrooms, remote offices, and anywhere in between
  • HANDLES VARIOUS MEDIA TYPES – Digitize receipts, business cards, plastic or embossed cards, reports, legal documents, and more
  • FAST AND EFFICIENT – No technical hurdles or complicated setups here; easily scan both sides of a document at the same time, in color or black-and-white, at up to 12 pages-per-minute, and with a 20 sheet automatic feeder
  • BROAD COMPATIBILITY – Works with both Windows and Mac devices, be it laptop or computer

Programmatic upload with the Drive API

For a fully automated pipeline, upload each image using Google Drive’s file upload API. Google documents three upload approaches:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Method When it fits Trade-off
Simple Small media files up to 5 MB when you do not need to provide metadata in the same request. Does not attach file metadata in that upload request.
Multipart Small media files up to 5 MB when you want metadata and file content in one request. Still intended for small files.
Resumable Larger files, or transfers over connections where interruption is a concern. It can also be used for small files. Requires an additional request to start the session and progress handling; the session URI expires after one week.

These size and method recommendations come from Google’s Drive upload documentation. A robust API workflow also needs OAuth authorization with permission to write to the destination Drive, a folder ID if saving into a specific folder, and a record of each created file’s ID and upload result. The exact implementation depends on your authentication setup and whether the destination is a user’s Drive or a shared drive.

Recover interrupted resumable uploads

Google’s resumable upload flow lets a client resume after a communication failure. Start a session and preserve the returned session URI; send file data to that URI with PUT requests. If the transfer stops, query the session for its status and use the server-reported Range to determine how many bytes it accepted. A 308 Resume Incomplete response means the upload has not finished; continue from the server-reported position rather than assuming the most recently sent chunk was received. The session URI is valid for one week, after which a new session is needed. Consult Google’s resumable upload guidance for the current request details.

Rank #4
IRIScan Express 4 Black Compact Portable USB Simplex Document Scanner, 8 PPM for Contracts, Invoices and Business Cards, Compatible with Windows, Readiris PDF Included
  • IRIScan Express, portable scanner : scans color and black and white documents a blazing speed up to 8ppm simplex. Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
  • IRIScan Express mobile scanner is powered via an included micro USB 2. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan. USB cable provided. AC Adapter not provided and not needed.
  • IRIScan flatbed scanner uses a simplex scanning mode allows for quick and straightforward scanning of single-sided documents. IRIScan with its full portable features is the ideal document scanners for computers.
  • IRIScan document scanner : Versatile scanning capabilities, including scanning to Word, PDF, and Excel formats with companion software provided Readiris OCR
  • Receipt scanner and card scanner with Additional features include scanning business cards directly to Outlook, photo scanning, and receipt scanning for efficient document management

What “batch upload” means in the Drive API

There are two separate batches in this workflow: your script’s list of URLs, and the screenshot files you upload. Drive API batch requests group eligible API calls to reduce connection overhead, but they do not batch media uploads or downloads. Google documents a maximum of 100 calls in a batch request and explicitly excludes media transfers; each screenshot’s bytes still require an individual upload operation. See Google’s Drive API performance guidance.

Performance, reliability, and cost considerations

  • Capture time varies by target. Page size, scripts, network conditions, and site-specific rendering affect how long navigation and screenshot capture take. The reviewed documentation does not establish one universally correct wait condition or concurrency level.
  • Start with sequential capture. The example processes one URL at a time, making failures easier to attribute and limiting resource use. If you later add concurrency, tune it against the target sites and your machine rather than treating a particular number of parallel pages as universally safe.
  • Keep capture and upload status separate. Record which URLs produced files and which Drive uploads succeeded. Then you can retry only the failed stage instead of recapturing every page.
  • Expect larger full-page files. Full-page screenshots include scrollable content and can produce larger images than viewport captures; choose the scope and output format based on what you need to preserve.
  • Do not mistake API batching for lower media-upload count. Eligible metadata calls can be grouped, but screenshot contents still upload individually.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common problems

The browser cannot open a URL

Check that the URL includes a scheme such as https://, that it is reachable from the machine running Playwright, and that the page is not timing out or redirecting unexpectedly. The example logs the failure and continues to the next URL; adjust the timeout or wait condition only for pages whose behavior warrants it.

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

A screenshot is blank or missing page content

The page may render key content after the navigation event used by the script. Wait for a page-specific selector that signals the content is ready, or use an appropriate navigation wait state for that site. A longer fixed delay is not a universal fix and adds time to every capture.

Best Value
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
  • Scanner type: Document
  • Connectivity technology: USB
  • With Auto Scan Mode, the scanner automatically detects what you're scanning
  • Digitize documents and images

One screenshot replaced another

Two captures used the same path. Give every URL a unique output name, such as the indexed filenames in the example, and confirm that the destination directory is not reused by another process.

Drive rejects or interrupts an upload

Confirm that the credentials are authorized to create files in the target location and that the request follows the selected upload method. For an interrupted resumable transfer, query session status and resume at the server-reported byte range; do not resend based only on the last local chunk position.

A Drive API batch request does not upload images

This is expected: Drive batch requests do not support media upload or download. Send a separate media upload for each screenshot; reserve batching for API calls that Google’s documentation identifies as eligible.

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.

Or skip the browser setup

ScreenshotNeo can capture a page with one GET request and return an image or PDF. For a URL list, your script still needs to loop over URLs and upload each returned image to Drive, but you can avoid installing and managing a browser for capture. Its capture process accepts cookie and consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before the screenshot; each of those steps can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the page verdict and billing status in headers. ScreenshotNeo also provides an MCP server with screenshot and PDF tools for AI agents. 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

ScreenshotNeo’s free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots. Sign up for the free plan.

Quick Recap

SaleBestseller No. 3
Canon imageFORMULA R10 - Portable Document Scanner, USB Powered, Duplex Scanning, Document Feeder, Easy Setup, Convenient, Perfect for Mobile Users, White
Canon imageFORMULA R10 - Portable Document Scanner, USB Powered, Duplex Scanning, Document Feeder, Easy Setup, Convenient, Perfect for Mobile Users, White
BROAD COMPATIBILITY – Works with both Windows and Mac devices, be it laptop or computer; This product is not intended for scanning photographs on photo paper / photographic media
$153.00
Bestseller No. 4
IRIScan Express 4 Black Compact Portable USB Simplex Document Scanner, 8 PPM for Contracts, Invoices and Business Cards, Compatible with Windows, Readiris PDF Included
IRIScan Express 4 Black Compact Portable USB Simplex Document Scanner, 8 PPM for Contracts, Invoices and Business Cards, Compatible with Windows, Readiris PDF Included
Find our Software here : irislink.com/start; IRIScan Express is only compatible Windows platform and not macintosh
$129.00
Bestseller No. 5
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
Scanner type: Document; Connectivity technology: USB; With Auto Scan Mode, the scanner automatically detects what you're scanning
$75.00

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.

browser automationDrive APIGoogle DrivePlaywrightweb screenshots

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.