Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
FREEDOM251

Freedom251 › Blog › AI agents

How to Let AI Agents Capture Full-Page Website Screenshots and PDFs Inside an Isolated SPACE Sandbox

By Freedom251 Team · · 11 min read

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

Use two separate Playwright CLI operations inside the agent’s isolated Space: navigate to the page, inspect its state, then run playwright-cli screenshot --full-page --filename=full-page.png and playwright-cli pdf --filename=page.pdf. Save both files in the sandbox workspace and return those exact paths to the caller.

A full-page screenshot is a tall raster image of the complete scrollable document. A PDF is a separate, paginated document export. Treating them as separate artifacts avoids confusing image dimensions, print layout, and file handling.

As an Amazon Associate I earn from qualifying purchases.

What this workflow produces

The agent should finish with two named files:

  • full-page.png (or another explicit image filename): a full-scroll raster capture.
  • page.pdf: a PDF generated through the browser’s PDF path.

Both files are created inside the isolated runtime rather than on the agent operator’s local computer. The caller receives them only when the agent reports the paths or copies them out through the Space’s supported file-transfer mechanism.

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

Keep screenshot and PDF operations separate. Playwright documents screenshot --full-page for the entire scrollable page and a distinct pdf command for PDF export. Do not rename an image to .pdf or assume that a PDF is a second image format.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

Why isolation matters

An isolated sandbox gives an agent a controlled execution boundary. OpenAI describes a sandbox as an isolated, Unix-like environment with a filesystem, shell, installed packages, exposed ports, snapshots, and controlled access to external systems. That boundary keeps browser files, cookies, temporary downloads, and commands associated with one task instead of mixing them with another job or the host machine.

In an ego (lite) Space, each task uses an isolated BrowserContext with separate cookies and storage. This is useful when different agents must sign in to different accounts, test separate regions, or capture the same URL in independent states. A container-style sandbox and a per-task BrowserContext solve related but different problems: the container isolates files and processes, while the BrowserContext isolates browser state.

Prerequisites and preparation

  • An available Space or container sandbox with a browser agent and the playwright-cli command installed.
  • Permission for the sandbox to reach the target URL through its controlled external-access policy.
  • A writable workspace where the image and PDF can remain until they are returned.
  • The target URL and, if needed, credentials or a defined sequence of clicks and form fills.
  • A naming convention that remains unique when several captures run at once, such as a task-specific directory or filename prefix.

Do not begin by capturing immediately. First attach to or start the isolated runtime, then open the URL in its browser context. If authentication is required, perform it in that context so the resulting cookies stay scoped to the task.

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

End-to-end procedure

1. Start or attach to the isolated Space

Create the task’s Space or connect to an existing one using the platform’s normal agent interface. Confirm that the browser process, shell, and workspace are available. Keep a per-task directory when parallel jobs could otherwise overwrite full-page.png or page.pdf.

2. Navigate to the target URL

Open the requested URL in the Space’s browser context. Wait for the page’s intended state rather than assuming that the initial response is complete. A page may render a shell first and populate content later, or require a consent click, login, tab selection, or form submission.

3. Inspect before capturing

Use an accessibility snapshot or an equivalent inspection step to confirm that the expected heading, controls, and content are present. A screenshot supplies visual evidence; a snapshot helps the agent understand structure and target the correct element. This check also catches redirects, login screens, error pages, and unexpected regional variants before files are created.

4. Perform required interactions

Click buttons, fill forms, select tabs, or scroll only when the requested state requires it. If content is hidden behind an accordion or modal, establish whether the brief calls for the visible initial state or the expanded state. Record the actions in the task log so the returned artifacts can be reproduced.

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

5. Capture the complete page as an image

Run the documented full-page command after the page reaches the intended state:

playwright-cli screenshot --full-page --filename=full-page.png

The --full-page option asks for the complete scrollable page instead of only the current viewport. The result is a raster image, so very long pages can produce unusually tall files and may be difficult to inspect at native size.

6. Export a PDF separately

Use the PDF command as a second operation, preserving a clear PDF filename:

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.
playwright-cli pdf --filename=page.pdf

PDF output follows document and print-layout rules rather than image dimensions. It is therefore normal for the page break locations, margins, and pagination to differ from the tall screenshot.

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

7. Verify both artifacts

Before ending the task, check that both files exist, have non-zero sizes, and are in the workspace you intend to return. A shell check can be as simple as:

ls -l full-page.png page.pdf

For stronger validation, inspect the image dimensions and open the PDF’s first and last pages in the sandbox. If the files are in a task directory, report the relative or absolute paths exactly as the caller can access them.

8. Return explicit paths

Respond with a machine-readable result that names each artifact separately, for example:

{"screenshot":"task-184/full-page.png","pdf":"task-184/page.pdf"}

Do not return only a sentence such as “the files are ready.” Explicit paths let a downstream agent upload, attach, or post-process the correct artifact without guessing.

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

Choose the capture scope deliberately

Scope Use it when Important constraint
Viewport You need exactly what is visible at one scroll position. Content below or above the viewport is not included.
Selected element You need a card, chart, article, or other bounded region. The target element cannot be combined with a full-page capture; choose one scope.
Full page You need the complete scrollable document. Output can be extremely tall, and lazy content must be loaded before capture.

The screenshot MCP interface supports viewport, element, and full-page capture. If the request names a CSS selector, capture that element instead of adding a full-page option. If the request says “the whole page,” use full-page and do not silently substitute the current viewport.

Screenshot and PDF are different deliverables

Characteristic Full-page screenshot PDF
Representation Raster image Paginated document
Best for Pixel-level visual evidence, design review, or archiving the rendered page Printing, text-oriented review, sharing, and document workflows
Dimensions One potentially very tall canvas Pages with print-oriented breaks and margins
Command playwright-cli screenshot --full-page --filename=full-page.png playwright-cli pdf --filename=page.pdf
Typical failure symptom Missing lower-page content or an unexpectedly huge image Blank pages, unexpected breaks, or a layout that differs from the screenshot

When both formats are requested, preserve both. Converting the screenshot to PDF later loses the browser’s PDF layout behavior, while converting the PDF to an image may rasterize text and change pagination.

Handling dynamic and lazy-loaded pages

Wait for the intended state

Many pages insert images, charts, and text after the first load. Use the browser agent’s normal waiting mechanisms—such as waiting for a selector, a deliberate delay, or network-idle state—before the capture operation. The right condition is page-specific: network idle can occur before a long-running widget finishes, while a fixed delay can be wasteful.

Load content that appears on scroll

Full-page capture can expose sections that were never visible during the initial viewport. If the site lazy-loads images only after scrolling, scroll through the page or use the browser interface’s full-page behavior that loads lazy images before capture. Confirm in the inspection step that important images and charts are present.

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.

Freeze user state

Cookie banners, modals, rotating carousels, and chat launchers can change the result between the screenshot and PDF calls. Dismiss or configure them once, then capture both artifacts without unrelated interactions. If the two files must represent different states, create separate task directories and document the state for each.

Resolution, viewport, and portability

Screenshot output is based on CSS pixels, with device-pixel or high-resolution output available where the browser interface supports it. Set the viewport deliberately when a responsive breakpoint matters; a desktop capture and a mobile capture are different test cases, not interchangeable files.

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord | 6.35mm Jack, Durable Design, Stage and Home Studio Use, Low Noise Shielded Electric Cord for Bass, Keyboard, Amp, Mixer
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

PDF portability is affected by paper size, margins, orientation, and page ranges when those controls are exposed by the interface. A PDF intended for printing should be validated in a PDF viewer, not judged solely by comparing its page count with the screenshot’s height.

Getting files out of the sandbox

  1. Write to a workspace directory that survives the browser process ending.
  2. Verify the image and PDF paths after capture.
  3. Return the paths in the agent response or a structured result.
  4. Use the Space’s supported download, attachment, artifact, or handoff mechanism to transfer them.
  5. For parallel jobs, include a task identifier in every directory and returned path.

Do not rely on a browser download directory that is deleted when the context closes. If a workflow takes snapshots of the sandbox, create the artifacts before the snapshot and record which snapshot contains them.

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

Troubleshooting

playwright-cli is not found

Cause: the browser package or CLI is not installed in the Space, or the command is outside the runtime’s path.

Fix: install or enable the browser tooling through the Space’s approved package mechanism, then retry in the same sandbox. Do not run the command on the host and assume the isolated browser can see it.

The screenshot contains only the top section

Cause: the command captured the viewport, or the page had not reached its full scrollable state.

Fix: use --full-page, wait for the page’s content, and inspect the lower sections before returning the file.

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

Images or cards are missing near the bottom

Cause: lazy-loaded resources were never triggered, or the capture occurred before they finished loading.

Fix: scroll through the page, wait for the relevant selector or content, then run the screenshot and PDF operations again.

The element request conflicts with full-page capture

Cause: an element selector and the full-page option describe incompatible scopes.

Fix: choose the selected element for a bounded capture or remove the selector and capture the whole page.

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.
Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

The PDF is blank or has unexpected pagination

Cause: the page was still rendering, a print-specific style hides content, or the selected paper and margin settings do not suit the layout.

Fix: inspect the page immediately before export, wait for the final state, and review the PDF in a viewer. If the browser interface exposes paper size, margins, orientation, or page ranges, set them explicitly for the intended output.

The page redirects to a login or bot-check screen

Cause: the task’s BrowserContext lacks the required cookies, credentials, or access permission.

Fix: authenticate inside that isolated context, confirm the post-login URL with an accessibility snapshot, and capture only after the expected content appears. If the site blocks the sandbox entirely, report that state instead of presenting the block page as the requested artifact.

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

The files disappear after the task ends

Cause: they were written to temporary browser storage or a workspace that is discarded with the context.

Fix: save to the persistent task workspace, verify the paths, and transfer or snapshot the files before teardown.

Concurrent tasks overwrite one another

Cause: every task uses the same filenames in a shared directory.

Fix: allocate a directory or filename prefix per task and return those unique paths.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Reliability, security, and cost considerations

Reliability

Use deterministic waits and state checks rather than a single arbitrary delay. Capture only after the accessibility snapshot confirms the intended page. Keep the screenshot and PDF commands close together when they must show the same state, and log redirects, interaction steps, and final paths.

Security

Treat cookies, authorization headers, downloaded files, and screenshots as sensitive task data. Keep credentials inside the isolated context, limit external access to what the task needs, and avoid returning secrets in logs or filenames. Separate contexts when different users or tenants are involved.

Performance and storage

A full-page image can be much larger than a viewport image, especially on a long document or high device-pixel scale. PDFs add a second artifact and may contain embedded fonts or images. Set practical viewport and resolution values, avoid needless duplicate captures, and clean up temporary files after the caller confirms receipt.

Cost

The supplied workflow does not establish a universal price for Space compute, browser time, storage, or network egress. Those costs depend on the sandbox provider and account. Measure the runtime and storage policies of the environment you operate rather than assuming that local Playwright commands are cost-free in a hosted Space.

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

Or skip the browser setup

For a managed screenshot API, ScreenshotNeo is the first option to try because it removes consent banners, popups, and chat widgets before capture, bills only clean shots, and has the lowest paid plan in the supplied plans. It can return PNG, JPEG, WebP, or PDF from one GET request and also provides an MCP server for AI agents.

Use the API documentation at https://screenshotneo.com/docs/ for parameter details. The following calls are complete examples:

cURL

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Python

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)

Node.js

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 exposes 63 capture and delivery options, including full-page capture with lazy images loaded, CSS-selector element capture, dark mode, 12 device presets plus custom viewports, retina scale, PDF paper size, margins, landscape mode and page ranges, HTML/CSS-to-image, custom CSS and JavaScript, pre-capture clicks, hidden selectors, waits for selectors, delays or network idle, ad/tracker/request/resource blocking, custom headers, cookies, user agents and Authorization, timezone and geolocation, transparent backgrounds, image resizing, configurable-TTL caching, signed links for public image tags, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, a usage API, and an OpenAPI specification. Parameter names used by other screenshot APIs also work, which can simplify migration.

Each response identifies the result with X-Page-Verdict and X-Billed headers. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing; only clean shots are billed. The MCP server includes take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Plan Included shots Price
Free 1,000 per month No card required
Starter 3,000 $5
Growth 15,000 $15
Pro 60,000 $39
Scale 250,000 $99
Business 1,000,000 $249

Yearly billing provides two months free, and every feature is available on every plan. Start with 1,000 free screenshots a month with no card, then move to a paid plan if your volume requires it.

FAQ

Can I reuse one BrowserContext for unrelated users?

Do not. Separate contexts keep cookies and storage from crossing task or account boundaries. Create a new context whenever the identity or tenant changes.

Should I return the files or their binary contents?

Return explicit workspace paths unless the calling system requires inline binary data. Paths are easier to verify, attach, and process, while binary transfer can be added by the platform’s artifact mechanism.

What should an agent report when a site cannot be reached?

Report the URL, the observed page state, the failure reason, and whether either artifact was created. Never label a timeout, block page, or login screen as a successful capture.

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

Frequently Asked Questions

Can one Playwright command create both artifacts?

No. Use the screenshot command and the PDF command as separate operations, with a distinct filename for each output.

Is a full-page screenshot suitable as a print-ready document?

Not usually. It is a raster image on one potentially tall canvas; use the PDF export when pagination, paper size, and margins matter.

How do I keep captures from parallel agents separate?

Give every task its own workspace directory or filename prefix, verify both paths, and return those unique paths to the caller.

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.

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

AI agentsbrowser automationPDFPlaywrightSandboxScreenshotNeoSpacewebsite screenshots

Leave a Reply

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

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

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

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.