Playwright vs Browserless for Scheduled Website Screenshots
Compare Playwright and Browserless for recurring website screenshots, with runnable capture examples, scheduling guidance, failure fixes, and a simpler API option.
Short answer: Choose Playwright when your scheduled captures need custom browser interactions, direct control over navigation and page state, or integration with an existing Playwright workflow. Choose Browserless when managed browser infrastructure or a stateless screenshot HTTP request better fits your operations. They can also be combined: Browserless documents connecting existing Playwright scripts to managed browsers. The available documentation does not establish a universal winner for cost, latency, uptime, or capture success.
This guide shows a runnable Playwright capture, a scheduled-run pattern, Browserless’s screenshot endpoint shape, and the operational decisions that matter for recurring jobs. It ends with ScreenshotNeo, a simpler one-request alternative when a screenshot API is all the job needs.
1. The difference that matters for scheduled captures
Playwright is a browser automation library. Your code drives a browser, chooses when a page is ready, captures an image, and decides what to do with the result. You also choose where that code runs and how it is scheduled.
Browserless is managed browser infrastructure with several interfaces. You can connect Playwright or Puppeteer to a managed browser over WebSocket, or send a stateless HTTP request to its screenshot API when a single capture does not need browser-library code. Browserless also describes REST and GraphQL APIs and cloud or Docker self-hosted options.
| Question | Playwright | Browserless |
|---|---|---|
| Who controls browser actions? | Your script controls browser and page APIs. | Your script can connect to a managed browser, or a screenshot request can delegate a stateless capture. |
| Where does scheduling live? | In the scheduler or job runner you select. | Do not assume the screenshot endpoint provides scheduling. Choose and operate a scheduler separately unless verified for your setup. |
| When does it fit? | Custom interactions, direct browser control, or an existing Playwright codebase. | Managed browser capacity, a remote Playwright workflow, or a simple screenshot request. |
| What is not established? | No evidence here establishes comparative price, latency, uptime, or success rates. | Same: verify current plans and measure the pages you intend to capture. |
For visual monitoring, Playwright Test can compare screenshots against reference images. Keep the browser version, operating system, settings, hardware, and headless mode consistent with the baseline environment: rendering can vary across those conditions.
2. Runnable scheduled screenshot capture with Playwright
This JavaScript example captures a full-page PNG and exits with a failure code if navigation or capture fails. It uses a fixed viewport and waits for a page-specific selector, which is more dependable than assuming a fixed delay fits every page.
import { chromium } from 'playwright';
const targetUrl = process.env.TARGET_URL ?? 'https://example.com';
const outputPath = process.env.OUTPUT_PATH ?? 'shot.png';
const readySelector = process.env.READY_SELECTOR;
const browser = await chromium.launch({ headless: true });
try {
const context = await browser.newContext({
viewport: { width: 1440, height: 1000 },
deviceScaleFactor: 1,
});
const page = await context.newPage();
const response = await page.goto(targetUrl, {
waitUntil: 'domcontentloaded',
timeout: 45_000,
});
if (!response) {
throw new Error('Navigation produced no main-resource response');
}
if (!response.ok()) {
throw new Error(`Page returned HTTP ${response.status()}`);
}
if (readySelector) {
await page.locator(readySelector).waitFor({ state: 'visible', timeout: 15_000 });
}
await page.screenshot({ path: outputPath, fullPage: true, type: 'png' });
console.log(`Saved ${outputPath} from ${targetUrl}`);
} finally {
await browser.close();
}
Install and run it from a project directory with Node.js and Playwright installed:
npm install playwright
npx playwright install chromium
TARGET_URL='https://example.com' OUTPUT_PATH='shot.png' node capture.mjs
Save the script as capture.mjs. Set READY_SELECTOR to a selector that appears when the content you need is present. For a page whose useful content is already available after DOM parsing, leave it unset.
Schedule it outside the capture script
A scheduled task should invoke the script, record the exit status, and store its output in a location your workflow can retrieve. For example, a Unix cron entry runs the capture every day at 06:00 UTC:
0 6 * * * cd /path/to/project && TARGET_URL='https://example.com' OUTPUT_PATH="captures/example-$(date +\%F).png" node capture.mjs
Create the output directory before the first run. In a hosted scheduler, use the equivalent schedule and pass the URL and output path as environment variables or job inputs. Configure retention and alerts in that scheduler or your storage system; the code above only writes a local file.
Capture variants and readiness options
- Viewport image: omit
fullPage: trueto capture the visible viewport. - Full page: use
fullPage: true. Very long pages may produce large images and take longer to render and store. - One element: wait for a locator and call
locator.screenshot({ path: outputPath }). This is useful for a chart or component rather than the entire page. - Image bytes: call
const bytes = await page.screenshot({ type: 'png' })to pass the image to storage or another process without writing a file first. - Format: Playwright screenshots support PNG, JPEG, and, where supported by the API/browser, options documented by Playwright. Set the type explicitly when downstream consumers require a format; JPEG quality can be set with the screenshot option.
- Wait conditions:
domcontentloadedis a starting point, not proof that a client-rendered app or lazy image is ready. Wait for a meaningful selector, a known app state, or an explicit bounded delay if the page requires it. Use network-idle style waits cautiously on pages with persistent network activity. - Authentication and state: create a context with the required cookies or storage state when you are authorized to access the page. Keep secrets out of source code and logs.
- Visual baselines: use a fixed viewport and the same browser/runtime environment for scheduled images you compare over time.
3. Browserless screenshot endpoint and remote Playwright
Browserless offers two relevant paths. Its screenshot REST API accepts a POST to /screenshot, authenticated with an account token, and returns an image. Its documented options include URL capture, image format, full-page output, waits, navigation settings, request filtering, and selector capture. The precise endpoint parameters and current account setup should be taken from the Browserless documentation for your account and deployment.
Because this dossier does not provide a verified token value, endpoint host, or complete request schema, the following is an intentionally schematic request shape. Replace the host, token, and options with the current documented values for your Browserless account; do not treat the placeholders as a copy-paste endpoint.
curl -X POST 'https://YOUR-BROWSERLESS-HOST/screenshot?token=YOUR_TOKEN' \
-H 'Content-Type: application/json' \
--data '{"url":"https://example.com","options":{"fullPage":true,"type":"png"}}' \
--output shot.png
For a recurring job, invoke this request from your scheduler and handle the returned HTTP status and image body. Add bounded retries for transient network or service errors, but do not blindly retry a deterministic page response such as an access-denied page.
If your workflow requires interactions beyond a URL capture, keep the Playwright script and connect it to Browserless’s documented WebSocket endpoint. This preserves page-level Playwright controls while delegating browser hosting. The exact connection URL and authentication syntax depend on the current Browserless configuration, so use its connection documentation rather than copying an unverified URL.
4. Choosing for your workload
- List the capture behavior. Note whether each page needs login, clicks, scrolling, a specific element, a viewport or full-page image, or a particular readiness signal.
- Choose the integration shape. A plain URL and image response may fit a stateless HTTP endpoint. Multi-step interaction or custom page logic points toward Playwright, locally hosted or connected to a managed browser.
- Decide operational ownership. With Playwright, you own the runtime, browser installation, job schedule, output storage, and failure handling. With a managed browser connection, verify what infrastructure is delegated and what remains your responsibility.
- Test representative sites. Include slow pages, client-rendered pages, long pages, authenticated pages, and pages with lazy-loaded content. Check the actual image, not only a successful HTTP response.
- Stabilize comparisons. Fix viewport and browser environment. Separate real site changes from rendering differences by keeping the baseline and scheduled environment aligned.
- Verify cost and limits. Compare current plan terms against the number of URLs, frequency, image sizes, concurrency, and retries you expect. The cited product documentation does not establish a price or performance winner.
Playwright and Browserless are not mutually exclusive: a team can retain its Playwright logic and connect to Browserless for managed browser capacity. The decision is about which parts of the capture stack you want your team to operate.
5. Failures, edge cases, and troubleshooting
| Symptom | Likely cause | What to change |
|---|---|---|
| Blank image or challenge page | The target blocks or challenges automated browsing, or responds differently to the capture environment. | Confirm authorized access and inspect the rendered page. Do not assume either service bypasses site restrictions. Use an approved access path if available. |
| Screenshot misses content | Capture ran before client rendering completed, or a lazy-loaded region was never brought into view. | Wait for a page-specific selector or state. For lazy content, scroll the relevant region into view and wait for its images/content before capture. |
| Navigation timeout | The page is slow, waits indefinitely on network activity, or a required resource never completes. | Use a realistic bounded timeout and a readiness condition tied to the content needed. Avoid making the whole job wait on unrelated persistent requests. |
| HTTP error or no response | DNS, network, authentication, redirect, or server failure; a navigation may also end without a main-resource response. | Log the URL, status when present, and failure class. Check the page independently and distinguish transport failures from a page that loaded an error screen. |
| Different images on successive runs | Dynamic ads, timestamps, rotating content, fonts, animations, viewport changes, or a different browser environment. | Keep environment and viewport fixed. Where appropriate, hide volatile elements with authorized page CSS or compare only the stable region. |
| Very large or slow full-page image | The page is unusually long, has large assets, or expands content during capture. | Capture only the needed element or viewport if that meets the requirement. Consider image format and downstream storage needs. |
| Browserless returns an error rather than an image | Invalid token, endpoint/configuration mismatch, unsupported option, or a navigation/capture failure. | Check the current Browserless API docs, account host and token, request body, response status, and service error details. |
| Scheduled job succeeds but no artifact appears | The scheduler runs in a different working directory or ephemeral filesystem, or the output path is not retained. | Use an explicit path and upload the image to durable storage as a separate job step. Verify the scheduler’s artifact and retention behavior. |
Browserless’s screenshot documentation specifically discusses blocked automation, blank captures, challenge pages, access-denied results, and incomplete content. Treat these as target-site and configuration checks, not as a promise that a provider can capture every page.
6. Performance, reliability, and cost
There is no source-backed benchmark here for relative capture speed, uptime, success rate, or total cost. A useful comparison is a small workload trial on your own representative URLs, using the intended schedule and capture settings. Record elapsed time, image dimensions, failed jobs, retries, and the time required to maintain the runtime. Check current commercial terms directly before making a budget decision.
- Performance: page rendering, third-party resources, full-page height, waits, and image encoding affect duration. Set a capture deadline appropriate to the job and measure complete runs rather than browser startup alone.
- Reliability: classify failures as transport, navigation, page-level denial, readiness timeout, or storage failure. Retry only transient categories, with a cap and delay, to avoid multiplying load or hiding persistent problems.
- Consistency: use the same environment as the visual baseline. A changed OS or browser version can alter rendering even when the site has not meaningfully changed.
- Cost: include the chosen scheduler, browser runtime or managed capacity, storage, and operational work in your calculation. Verify current plan limits and pricing; the available sources do not support a numerical comparison.
- Target-site behavior: CAPTCHA, access controls, bot checks, and rate limits can prevent a usable image. Capture only pages you are permitted to access and plan for explicit failure reporting.
7. Or skip the browser setup
If the scheduled task only needs a URL turned into an image, ScreenshotNeo is a screenshot API alternative to try first: one GET request returns a clean PNG, JPEG, WebP, or PDF. The API documentation covers the request options.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Cookie and consent banners are accepted before capture, and 60+ known consent platforms, newsletter popups, and chat widgets are removed; each cleanup step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. An MCP server gives Claude, Cursor, and other MCP clients the tools 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 shots.
Create a free ScreenshotNeo account and get 1,000 screenshots a month with no card.
8. FAQ
Can Browserless run my schedule for me?
The cited screenshot endpoint describes capture requests, not job scheduling. Run it from a scheduler you select unless you separately verify a scheduling feature for your Browserless setup.
Can I use Playwright with Browserless?
Yes. Browserless documents a WebSocket connection path for Playwright and Puppeteer, so the tools can be combined.
Should I use screenshot baselines for scheduled monitoring?
They can help detect visual changes, but keep the capture environment consistent and account for expected dynamic page content before treating every pixel difference as a meaningful change.
Which one is cheaper?
The available evidence does not establish that. Check current pricing and compare the full workflow cost for your volume, browser needs, storage, and operations.
Does either option guarantee capture through CAPTCHA or access denial?
No such guarantee is supported here. These conditions may produce a challenge or unusable image; use authorized access and report the failure clearly.
