How to Capture Google Results Screenshots with a Screenshot API
Capture a Google Search results page with Playwright or a screenshot API. Get runnable code, reproducibility tips, troubleshooting, and guidance on usage boundaries.
To capture a Google Search results page, send its URL to a screenshot API and save the returned image, or use Playwright to open the URL in a browser and call page.screenshot(). For repeatable results, record the exact URL, query, viewport, locale, region, and capture time. A tool that can render a URL does not establish permission to automate Google Search or reuse content shown in the results.
1. Build the results URL
Start with a normal Google Search URL. URL-encode the query so spaces and punctuation are transmitted correctly. For example, https://www.google.com/search?q=playwright requests results for “playwright.” Add parameters only when you understand their effect; results can vary by location, language, personalization, and time.
https://www.google.com/search?q=playwright
Use the exact URL in every capture run. If a result page is for documentation or research, keep a record of the query and the time captured alongside the image.
2. Capture it yourself with Playwright
Playwright’s Page API supports screenshots of the visible viewport and full-page screenshots. This example uses Node.js, opens a browser page, waits for navigation, captures the viewport, and closes the browser. Install Playwright and its browser first:
npm install playwright
npx playwright install chromium
// capture-google.mjs
import { chromium } from 'playwright';
const query = process.argv.slice(2).join(' ') || 'playwright';
const url = `https://www.google.com/search?q=${encodeURIComponent(query)}`;
const browser = await chromium.launch({ headless: true });
try {
const context = await browser.newContext({
viewport: { width: 1365, height: 900 },
locale: 'en-US',
});
const page = await context.newPage();
await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 60000 });
await page.screenshot({ path: 'google-results.png' });
} finally {
await browser.close();
}
Run it with node capture-google.mjs "playwright screenshot". The screenshot path is relative to the working directory. The example captures the visible viewport. To capture the full scrollable document, change the screenshot call to:
await page.screenshot({ path: 'google-results-full.png', fullPage: true });
Full-page capture can produce a very tall image, and content that loads only after scrolling may not be present until the page is scrolled. For stable output, use a fixed viewport, a consistent browser version and locale, and the same query URL.
Playwright documents screenshot options and the full-page setting in its Page API reference.
3. Capture a URL with a hosted screenshot API
A hosted screenshot API takes a URL and capture options, renders it, and returns image bytes. Providers differ: confirm their current documentation for supported formats, readiness controls, full-page behavior, authentication, and output handling. Do not assume a URL-loading API makes automated Search requests permissible.
cURL
curl -G "https://api.screenshotneo.com/v1/shot" \
-d access_key=YOUR_API_KEY \
--data-urlencode url='https://www.google.com/search?q=playwright' \
-o google-results.webp
Python
import requests
url = 'https://www.google.com/search?q=playwright'
r = requests.get(
'https://api.screenshotneo.com/v1/shot',
params={'access_key': 'YOUR_API_KEY', 'url': url},
timeout=90,
)
r.raise_for_status()
with open('google-results.webp', 'wb') as image:
image.write(r.content)
Node.js
const target = 'https://www.google.com/search?q=playwright';
const q = new URLSearchParams({
access_key: 'YOUR_API_KEY',
url: target,
});
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot request failed: ${res.status}`);
await Bun.write('google-results.webp', new Uint8Array(await res.arrayBuffer()));
The Node example uses Bun’s file-writing API. With Node.js alone, replace the last line with import { writeFile } from 'node:fs/promises'; await writeFile('google-results.webp', Buffer.from(await res.arrayBuffer())); and run the file as an ES module.
See the ScreenshotNeo API documentation for request options and response details.
4. Set capture options for reproducibility
Keep capture settings explicit and change one at a time when diagnosing differences. Common screenshot controls include:
| Setting | Use | Watch for |
|---|---|---|
| URL and query | Capture the intended results page | Encode query characters; save the exact final URL |
| Viewport | Make line wrapping and visible results consistent | A different width changes layout and the number of visible results |
| Locale and region | Control language and regional presentation when supported | Locale is not always the same as search location |
| Wait/readiness | Allow the page to render before capture | Longer waits add latency; a fixed delay cannot guarantee every resource is ready |
| Full page | Capture content below the fold | Images may lazy-load only after scrolling; output can be very tall |
| Output format | Choose an image format suitable for storage or publication | Check returned content type and file extension |
The ScreenshotNeo endpoint accepts a URL and supports a configurable post-load delay and full-page capture; consult its current documentation for the exact parameter names and other options. In Playwright, viewport and locale are set on the browser context, while full-page capture is passed to page.screenshot().
5. Handle dynamic pages and edge cases
- Consent prompts: Search pages can show consent or region prompts that change what is visible. Capture the state relevant to your use, and do not silently edit the interface in a way that misrepresents it.
- Personalized or changing results: The same query can produce different results over time or in different contexts. Save capture time, URL, viewport, locale, and region assumptions with the image.
- Lazy-loaded content: A full-page option may not cause every offscreen asset to load. In browser automation, scroll in controlled increments and allow the page to update before the final capture if those assets matter.
- Very long pages: Full-page images can consume substantial memory and may be unwieldy to review. Use viewport screenshots when only the first screen is needed.
- Authentication and secrets: Avoid placing API keys in shared source files, public repositories, or browser-visible code. Keep credentials in environment variables in production workflows.
- Returned errors: Check the HTTP status and response headers before saving bytes as an image; an error response saved with a
.pngor.webpsuffix is still an error document.
6. Google usage and image rights
Capturing an image technically is separate from permission to automate Search or republish what appears on the page. Google’s Search screenshot guidance says to represent the interface naturally and unmodified, avoid implying endorsement or affiliation, and obtain any needed third-party approvals for content visible in the screenshot. It describes permission for screenshots of Google Search pages in print for educational or instructional purposes; that is a specific exception, not blanket permission for every digital, promotional, or commercial use. Review the current Google Search screenshot and brand guidance for your intended use.
Google also documents a Search Researcher Result API for eligible users who apply; it is limited to noncommercial use under its program terms and returns HTML, not a screenshot. A browser renderer is still needed to turn that HTML into an image. See Google’s Search Researcher Result API information. Do not infer that a screenshot service’s ability to load a URL authorizes automated Search queries; check current Google terms and policies for your use case.
7. Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server for developers. One GET request returns an image or PDF. For a Google results URL, use the same endpoint pattern:
curl -G "https://api.screenshotneo.com/v1/shot" \
-d access_key=YOUR_API_KEY \
--data-urlencode url='https://www.google.com/search?q=playwright' \
-o google-results.webp
ScreenshotNeo accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, with page verdict and billing details in response headers. Its MCP server lets AI agents use take_screenshot, get_page_info, and capture_pdf. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots.
Read the ScreenshotNeo docs for supported parameters and response headers. A screenshot API does not grant permission to automate Google Search or republish results, so check the applicable Google rules for your use.
Sign up free for 1,000 screenshots a month, with no card required.
8. Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Screenshot is blank or incomplete | Navigation or rendering had not completed, or the page failed to load | Wait for a suitable readiness condition, check the final page URL, and inspect response status before capture |
| Consent screen fills the image | A prompt is blocking the results | Decide whether that state belongs in the record; use a legitimate consent flow and preserve an unaltered representation |
| Different runs show different results | Query, region, locale, personalization, or time changed | Record these inputs and use a consistent browser context and viewport |
| Offscreen images are missing | Lazy loading has not been triggered | Scroll the page before capture and allow assets to load, or capture only the viewport |
| Saved image cannot be opened | An HTTP error body was written as an image | Check HTTP status and headers; only save successful image responses |
| Request times out | The page or a resource is slow, or the timeout is too short | Set a reasonable timeout, reduce unnecessary waiting, and retry selectively; avoid unbounded retry loops |
| API returns an authorization error | Missing, invalid, or exposed API key | Verify the key and parameter spelling, keep secrets out of client-side code, and consult provider response documentation |
9. Performance, reliability, and cost
Self-managed Playwright gives control over browser version, context, and capture flow, but you must install and maintain browser binaries and operate the capture environment. A hosted API avoids running the browser yourself, while adding a network request and provider-specific limits and terms. Neither approach guarantees identical Google results across time or context.
For lower latency and predictable resource use, capture only the viewport unless the full page is necessary. Full-page captures and extra waits increase work and output size. Reuse a stable browser setup for batches, set finite timeouts, and retry only transient failures. For hosted services, check current plan limits, cache behavior, data handling, and pricing in the provider’s documentation; do not infer a cost from a successful HTTP response. ScreenshotNeo states that only clean shots are billed and cache hits and failed loads cost nothing, and lists its plans on its site. These billing terms do not change Google usage requirements.
10. FAQ
Can a screenshot API capture a Google results page directly?
It can attempt to render a supplied URL and return an image, subject to the service’s capabilities and the target page’s behavior. That technical capability does not establish permission for automated Search requests.
Should I use a screenshot or Google’s Researcher Result API?
They serve different needs. A screenshot API returns a rendered image; Google’s Researcher Result API returns HTML, requires eligibility and application, and is for noncommercial use under its program terms.
Does full-page capture include every search result?
It captures the rendered scrollable page the browser exposes. It does not promise that every result or lazy-loaded asset is present, and it cannot guarantee a fixed number of results.
Can I use the screenshot in an advertisement?
Do not assume so. Review Google’s current screenshot guidance and get approvals for third-party material where needed; avoid implying endorsement or affiliation.


